lkml.org 
[lkml]   [2004]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2.6] Class support for ppdev.c
On Sat, Apr 10, 2004 at 09:46:01PM +0200, Marcel Sebek wrote:
> And new updated patch. partport_find_number() needs to decrement refcount
> by parport_put_port().

And it's still broken. New parports can appear at any point - hell, we even
have USB->parport converters. IOW, if you want to do something useful here -
use ->attach()/->detach() of parport_driver.

> for (i = 0; i < PARPORT_MAX; i++) {
> - devfs_mk_cdev(MKDEV(PP_MAJOR, i),
> + if ((port = parport_find_number(i))) {
> + class_simple_device_add(ppdev_class, MKDEV(PP_MAJOR, i),
> + NULL, "parport%d", i);
> + parport_put_port(port);
> + }
> + err = devfs_mk_cdev(MKDEV(PP_MAJOR, i),
> S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i);
> + if (err)
> + goto out_class;
> }
>
> printk (KERN_INFO PP_VERSION "\n");
> - return 0;
> + goto out;
> +
> +out_class:
> + for (i = 0; i < PARPORT_MAX; i++)
> + class_simple_device_remove(MKDEV(PP_MAJOR, i));


*raised brows*

So you are freeing the stuff you've never allocated? Cute...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.138 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site