linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shailendra Verma <shailendra.v@samsung.com>
To: Kishon Vijay Abraham I <kishon@ti.com>,
	linux-kernel@vger.kernel.org, p.shailesh@samsung.com,
	ashish.kalra@samsung.com,
	Shailendra Verma <shailendra.v@samsung.com>,
	Shailendra Verma <shailendra.capricorn@gmail.com>
Subject: [PATCH] phy - Fix possible NULL derefrence.
Date: Mon, 30 Jan 2017 10:20:23 +0530	[thread overview]
Message-ID: <1485751823-29182-1-git-send-email-shailendra.v@samsung.com> (raw)
In-Reply-To: CGME20170130045040epcas3p12f5d7e91329798c31ed5daacfb2d96a8@epcas3p1.samsung.com

of_match_device could return NULL, and so can cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.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

           reply	other threads:[~2017-01-30  5:04 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CGME20170130045040epcas3p12f5d7e91329798c31ed5daacfb2d96a8@epcas3p1.samsung.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485751823-29182-1-git-send-email-shailendra.v@samsung.com \
    --to=shailendra.v@samsung.com \
    --cc=ashish.kalra@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.shailesh@samsung.com \
    --cc=shailendra.capricorn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).