public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ambx1@neo.rr.com (Adam Belay)
To: matthieu castet <castet.matthieu@free.fr>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [bug] pnp_register_card_driver/pnp_unregister_card_driver
Date: Mon, 7 Feb 2005 15:01:13 -0500	[thread overview]
Message-ID: <20050207200113.GC3621@neo.rr.com> (raw)
In-Reply-To: <4207C29B.8030105@free.fr>

On Mon, Feb 07, 2005 at 08:33:47PM +0100, matthieu castet wrote:
> Hi,
> 
> pnp_register_driver could fail and return <0 result, in this case the 
> driver shouldn't be pnp_unregister_driver.
> 
> But if you look in pnp_register_card_driver, the result isn't checked. 
> And it is always pnp_unregister_driver in pnp_unregister_card_driver.
> 
> I know that pnp_register_card_driver shouldn't fail in normal condition, 
> but who know...
> 
> 
> Matthieu

Yeah, you're right.  I'm probably going to do something like this.

--- a/drivers/pnp/card.c	2005-01-20 17:38:02.000000000 -0500
+++ b/drivers/pnp/card.c	2005-02-07 14:53:24.000000000 -0500
@@ -355,10 +355,12 @@
 	drv->link.probe = NULL;
 	drv->link.remove = &card_remove_first;
 
+	if ((count = pnp_register_driver(&drv->link) < 0))
+		return count;
+
 	spin_lock(&pnp_lock);
 	list_add_tail(&drv->global_list, &pnp_card_drivers);
 	spin_unlock(&pnp_lock);
-	pnp_register_driver(&drv->link);
 
 	list_for_each_safe(pos,temp,&pnp_cards){
 		struct pnp_card *card = list_entry(pos, struct pnp_card, global_list);

Thanks,
Adam

  reply	other threads:[~2005-02-07 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-07 19:33 [bug] pnp_register_card_driver/pnp_unregister_card_driver matthieu castet
2005-02-07 20:01 ` Adam Belay [this message]
2005-02-07 20:23   ` matthieu castet

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=20050207200113.GC3621@neo.rr.com \
    --to=ambx1@neo.rr.com \
    --cc=castet.matthieu@free.fr \
    --cc=linux-kernel@vger.kernel.org \
    /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