ptp_qoriq: fix NULL access if ptp dt node missing
authorClaudiu Manoil <claudiu.manoil@nxp.com>
Thu, 9 May 2019 03:07:12 +0000 (03:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 May 2019 16:19:26 +0000 (09:19 -0700)
Make sure ptp dt node exists before accessing it in case
of NULL pointer call trace.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_qoriq.c

index 53775362aac633396993f12b98c837cc06c0651e..e10642403b25890e3402d07b8bb49b06a9e79c7a 100644 (file)
@@ -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;