From 7f4399ba405b6201fb318b43091703a34b1489ab Mon Sep 17 00:00:00 2001 From: Claudiu Manoil Date: Thu, 9 May 2019 03:07:12 +0000 Subject: [PATCH] ptp_qoriq: fix NULL access if ptp dt node missing Make sure ptp dt node exists before accessing it in case of NULL pointer call trace. Signed-off-by: Claudiu Manoil Signed-off-by: Yangbo Lu Acked-by: Richard Cochran Signed-off-by: David S. Miller --- drivers/ptp/ptp_qoriq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c index 5377536..e106424 100644 --- a/drivers/ptp/ptp_qoriq.c +++ b/drivers/ptp/ptp_qoriq.c @@ -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; -- 2.7.4