Merge branch 'misdn-fixes'

Yang Yingliang says:

====================
two fixes for mISDN

This patchset fixes two issues when device_add() returns error.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2022-11-02 12:34:48 +00:00
commit ba9169f570
2 changed files with 4 additions and 3 deletions

View File

@ -956,7 +956,7 @@ nj_release(struct tiger_hw *card)
} }
if (card->irq > 0) if (card->irq > 0)
free_irq(card->irq, card); 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); mISDN_unregister_device(&card->isac.dch.dev);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {

View File

@ -233,11 +233,12 @@ mISDN_register_device(struct mISDNdevice *dev,
if (debug & DEBUG_CORE) if (debug & DEBUG_CORE)
printk(KERN_DEBUG "mISDN_register %s %d\n", printk(KERN_DEBUG "mISDN_register %s %d\n",
dev_name(&dev->dev), dev->id); dev_name(&dev->dev), dev->id);
dev->dev.class = &mISDN_class;
err = create_stack(dev); err = create_stack(dev);
if (err) if (err)
goto error1; goto error1;
dev->dev.class = &mISDN_class;
dev->dev.platform_data = dev; dev->dev.platform_data = dev;
dev->dev.parent = parent; dev->dev.parent = parent;
dev_set_drvdata(&dev->dev, dev); dev_set_drvdata(&dev->dev, dev);
@ -249,8 +250,8 @@ mISDN_register_device(struct mISDNdevice *dev,
error3: error3:
delete_stack(dev); delete_stack(dev);
return err;
error1: error1:
put_device(&dev->dev);
return err; return err;
} }