]> git.baikalelectronics.ru Git - kernel.git/commitdiff
octeontx2-af: Increment ptp refcount before use
authorSubbaraya Sundeep <sbhatta@marvell.com>
Fri, 7 Jan 2022 06:30:29 +0000 (12:00 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 7 Jan 2022 14:04:19 +0000 (14:04 +0000)
Before using the ptp pci device by AF driver increment
the reference count of it.

Fixes: be9ca1d73770 ("octeontx2-af: Add PTP device id for CN10K and 95O silcons")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/af/ptp.c

index d6321de3cc17195e2324b955480d3a9717b5892a..e682b7bfde6407c7d9cab3dff320c757d3f4a72a 100644 (file)
@@ -60,6 +60,8 @@ struct ptp *ptp_get(void)
        /* Check driver is bound to PTP block */
        if (!ptp)
                ptp = ERR_PTR(-EPROBE_DEFER);
+       else
+               pci_dev_get(ptp->pdev);
 
        return ptp;
 }