[<prev] [next>] [day] [month] [year] [list]
Message-id: <1485751823-29182-1-git-send-email-shailendra.v@samsung.com>
Date: Mon, 30 Jan 2017 10:20:23 +0530
From: Shailendra Verma <shailendra.v@...sung.com>
To: Kishon Vijay Abraham I <kishon@...com>,
linux-kernel@...r.kernel.org, p.shailesh@...sung.com,
ashish.kalra@...sung.com,
Shailendra Verma <shailendra.v@...sung.com>,
Shailendra Verma <shailendra.capricorn@...il.com>
Subject: [PATCH] phy - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL
pointer dereference later.
Signed-off-by: Shailendra Verma <shailendra.v@...sung.com>
---
drivers/phy/phy-berlin-usb.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c
index 2017751..c85c516 100644
--- a/drivers/phy/phy-berlin-usb.c
+++ b/drivers/phy/phy-berlin-usb.c
@@ -172,6 +172,11 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
struct phy *phy;
struct phy_provider *phy_provider;
+ if (!match) {
+ dev_err(&pdev->dev, "Error: No device match found\n");
+ return -ENODEV;
+ }
+
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
--
1.7.9.5
Powered by blists - more mailing lists