aboutsummaryrefslogtreecommitdiff
path: root/drivers/ptp/ptp_qoriq.c
diff options
context:
space:
mode:
authorClaudiu Manoil <claudiu.manoil@nxp.com>2019-05-09 03:07:12 +0000
committerDavid S. Miller <davem@davemloft.net>2019-05-09 09:19:26 -0700
commit7f4399ba405b6201fb318b43091703a34b1489ab (patch)
tree9a9edb45a2ca9fcc0431f98f07f2ee7b86f5cebf /drivers/ptp/ptp_qoriq.c
parent5f05836831f6142081e216f27e1ae8f4b26d3585 (diff)
downloadlinux-7f4399ba405b6201fb318b43091703a34b1489ab.tar.gz
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 <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>
Diffstat (limited to 'drivers/ptp/ptp_qoriq.c')
-rw-r--r--drivers/ptp/ptp_qoriq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 53775362aac6..e10642403b25 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;