From: Subbaraya Sundeep Date: Fri, 7 Jan 2022 06:30:29 +0000 (+0530) Subject: octeontx2-af: Increment ptp refcount before use X-Git-Tag: baikal/aarch64/sdk6.1~4966^2^2~7^2~1 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=2af0b1ed90a8bed07b15b775a140d6ecbea22746;p=kernel.git octeontx2-af: Increment ptp refcount before use 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 Signed-off-by: Sunil Goutham Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c index d6321de3cc171..e682b7bfde640 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c @@ -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; }