]> git.baikalelectronics.ru Git - kernel.git/commitdiff
isdn: mISDN: netjet: fix wrong check of device registration
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 31 Oct 2022 12:13:41 +0000 (20:13 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Nov 2022 12:34:48 +0000 (12:34 +0000)
The class is set in mISDN_register_device(), but if device_add() returns
error, it will lead to delete a device without added, fix this by using
device_is_registered() to check if the device is registered.

Fixes: a900845e5661 ("mISDN: Add support for Traverse Technologies NETJet PCI cards")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/hardware/mISDN/netjet.c

index a52f275f826348475b0f49a241ee73b2c6553fca..f8447135a90220bf24eef9403d13f725035ef43a 100644 (file)
@@ -956,7 +956,7 @@ nj_release(struct tiger_hw *card)
        }
        if (card->irq > 0)
                free_irq(card->irq, card);
-       if (card->isac.dch.dev.dev.class)
+       if (device_is_registered(&card->isac.dch.dev.dev))
                mISDN_unregister_device(&card->isac.dch.dev);
 
        for (i = 0; i < 2; i++) {