Skip to contentSkip to conversation

ptp_qoriq: fix NULL access if ptp dt node missing

PATCH Applied Y.b. Lu 3 participants 3 messages May 9, 2019

Subsystems (4)
lore
Share & tools
lore

Y.b. Lu

author maintainer
#0 lore raw

PATCH 1/1 ptp_qoriq: fix NULL access if ptp dt node missing

From: Claudiu Manoil <[email protected]>

Make sure ptp dt node exists before accessing it in case of NULL pointer call trace.

---
 drivers/ptp/ptp_qoriq.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/ptp/ptp_qoriq.c +3 -0
index 53775362aac6..e10642403b25 100644
@@ -467,6 +467,9 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
 	unsigned long flags;
 	u32 tmr_ctrl;
 
+	if (!node)
+		return -ENODEV;
+
 	ptp_qoriq->base = base;
 	ptp_qoriq->caps = *caps;
 
Signature · 1 line
2.17.1