Skip to content

Commit

Permalink
net: hns: Fix object reference leaks in hns_dsaf_roce_reset()
Browse files Browse the repository at this point in the history
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Huang Zijiang authored and David S. Miller committed Feb 14, 2019
1 parent 2c2ade8 commit c969c6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3081,13 +3081,15 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
dsaf_dev = dev_get_drvdata(&pdev->dev);
if (!dsaf_dev) {
dev_err(&pdev->dev, "dsaf_dev is NULL\n");
put_device(&pdev->dev);
return -ENODEV;
}

/* now, make sure we are running on compatible SoC */
if (AE_IS_VER1(dsaf_dev->dsaf_ver)) {
dev_err(dsaf_dev->dev, "%s v1 chip doesn't support RoCE!\n",
dsaf_dev->ae_dev.name);
put_device(&pdev->dev);
return -ENODEV;
}

Expand Down

0 comments on commit c969c6e

Please sign in to comment.