[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230607070255.2013980-1-saikrishnag@marvell.com>
Date: Wed, 7 Jun 2023 12:32:55 +0530
From: Sai Krishna <saikrishnag@...vell.com>
To: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <sgoutham@...vell.com>,
<dan.carpenter@...aro.org>
CC: Sai Krishna <saikrishnag@...vell.com>,
Naveen Mamindlapalli <naveenm@...vell.com>
Subject: [net PATCH] octeontx2-af: Fix pointer dereference before sanity check
PTP pointer is being dereferenced before NULL, error check.
Fixed the same to avoid NULL dereference and smatch checker warning.
Fixes: 2ef4e45d99b1 ("octeontx2-af: Add PTP PPS Errata workaround on CN10K silicon")
Signed-off-by: Sai Krishna <saikrishnag@...vell.com>
Signed-off-by: Naveen Mamindlapalli <naveenm@...vell.com>
---
drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
index 3411e2e47d46..6a7dfb181fa8 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
@@ -449,12 +449,12 @@ static void ptp_remove(struct pci_dev *pdev)
struct ptp *ptp = pci_get_drvdata(pdev);
u64 clock_cfg;
- if (cn10k_ptp_errata(ptp) && hrtimer_active(&ptp->hrtimer))
- hrtimer_cancel(&ptp->hrtimer);
-
if (IS_ERR_OR_NULL(ptp))
return;
+ if (cn10k_ptp_errata(ptp) && hrtimer_active(&ptp->hrtimer))
+ hrtimer_cancel(&ptp->hrtimer);
+
/* Disable PTP clock */
clock_cfg = readq(ptp->reg_base + PTP_CLOCK_CFG);
clock_cfg &= ~PTP_CLOCK_CFG_PTP_EN;
--
2.25.1
Powered by blists - more mailing lists