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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to