The refcount of shost_gendev is get snic_tgt_create(), but it has never been put while module exiting in normal path, so add put_device() in snic_tgt_dev_release() to avoid refcount leak. Fixes: c8806b6c9e82 ("snic: driver for Cisco SCSI HBA") Cc: Karan Tilak Kumar <kartilak@xxxxxxxxx> Cc: Sesidhar Baddela <sebaddel@xxxxxxxxx> Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxx> Cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> --- drivers/scsi/snic/snic_disc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c index 031c27d8510f..d0759391ed1e 100644 --- a/drivers/scsi/snic/snic_disc.c +++ b/drivers/scsi/snic/snic_disc.c @@ -198,6 +198,7 @@ snic_tgt_dev_release(struct device *dev) dev_name(dev)); SNIC_BUG_ON(!list_empty(&tgt->list)); + put_device(dev->parent); kfree(tgt); } @@ -303,7 +304,6 @@ snic_tgt_create(struct snic *snic, struct snic_tgt_id *tgtid) "Snic Tgt: device_add, with err = %d\n", ret); - put_device(&snic->shost->shost_gendev); put_device(&tgt->dev); return NULL; } -- 2.25.1