ptp: ocp: Fix error handling in ptp_ocp_device_init
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Fri, 22 Sep 2023 09:40:44 +0000 (17:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Oct 2023 06:19:22 +0000 (07:19 +0100)
When device_add() fails, ptp_ocp_dev_release() will be called
after put_device(). Therefore, it seems that the
ptp_ocp_dev_release() before put_device() is redundant.

Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the timecard.")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Vadim Feodrenko <vadim.fedorenko@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_ocp.c

index 20a974c..a7a6947 100644 (file)
@@ -3998,7 +3998,6 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev)
        return 0;
 
 out:
-       ptp_ocp_dev_release(&bp->dev);
        put_device(&bp->dev);
        return err;
 }