From: Jan Weitzel <j.weitzel@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH] smsc911x: Check platformdata pointer
Date: Mon, 10 Sep 2012 13:33:29 +0200 [thread overview]
Message-ID: <1347276809-8029-1-git-send-email-j.weitzel@phytec.de> (raw)
If pdata is NULL smc911x_probe will crash. Checking the zero initialized
priv->shift results in default configuration if pdata is not set.
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
---
drivers/net/smc911x.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index bc1e001..f697608 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -435,7 +435,7 @@ static int smc911x_probe(struct device_d *dev)
priv->shift = pdata->shift;
if (is_32bit) {
- if (pdata->shift) {
+ if (priv->shift) {
priv->reg_read = __smc911x_reg_readl_shift;
priv->reg_write = __smc911x_reg_writel_shift;
} else {
@@ -443,7 +443,7 @@ static int smc911x_probe(struct device_d *dev)
priv->reg_write = __smc911x_reg_writel;
}
} else {
- if (pdata->shift) {
+ if (priv->shift) {
priv->reg_read = __smc911x_reg_readw_shift;
priv->reg_write = __smc911x_reg_writew_shift;
} else {
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2012-09-10 11:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-10 11:33 Jan Weitzel [this message]
2012-09-10 16:07 ` Sascha Hauer
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=1347276809-8029-1-git-send-email-j.weitzel@phytec.de \
--to=j.weitzel@phytec.de \
--cc=barebox@lists.infradead.org \
/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