mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "eric miao" <eric.y.miao@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: "Szabolcs Gyurko" <szabolcs.gyurko@tlt.hu>
Subject: [PATCH] make ds1wm driver to check ds1wm_platform_data pointer against NULL
Date: Fri, 9 Nov 2007 14:07:31 +0800	[thread overview]
Message-ID: <f17812d70711082207p455c5bc9v25fea9a0585ba152@mail.gmail.com> (raw)

Do a sanity check for the "struct ds1wm_platform_data" pointer passed in
by the platform_device, and so to enforce each platform to provide a
valid structure.

Signed-off-by: eric miao <eric.miao@marvell.com>
---
 drivers/w1/masters/ds1wm.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index 5747997..11ce9ec 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -351,6 +351,10 @@ static int ds1wm_probe(struct platform_device *pdev)
 		goto err0;
 	}
 	plat = pdev->dev.platform_data;
+	if (!plat) {
+		ret = -ENXIO;
+		goto err0;
+	}
 	ds1wm_data->bus_shift = plat->bus_shift;
 	ds1wm_data->pdev = pdev;
 	ds1wm_data->pdata = plat;
-- 
1.5.2.5.GIT

             reply	other threads:[~2007-11-09  6:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09  6:07 eric miao [this message]
2007-11-10  1:02 ` Andrew Morton
2007-11-10 17:08   ` Evgeniy Polyakov
2007-11-11  2:26     ` eric miao

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=f17812d70711082207p455c5bc9v25fea9a0585ba152@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=szabolcs.gyurko@tlt.hu \
    /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

all inboxes | Powered by JetHome®