mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org, tim@cyberelk.net
Subject: Re: [PATCH 2.6] Class support for ppdev.c
Date: Sat, 10 Apr 2004 21:28:59 +0100	[thread overview]
Message-ID: <20040410202858.GU31500@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20040410194601.GC3612@penguin.localdomain>

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...

  reply	other threads:[~2004-04-10 20:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-10 13:51 Marcel Sebek
2004-04-10 17:01 ` Greg KH
2004-04-10 18:06   ` Marcel Sebek
2004-04-10 19:46     ` Marcel Sebek
2004-04-10 20:28       ` viro [this message]
2004-04-11  8:25         ` Marcel Sebek
2004-04-12 18:51           ` Greg KH
2004-04-13 17:29             ` Marcel Sebek
2004-05-02  6:29               ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040410202858.GU31500@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim@cyberelk.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®