From: Andreas Schwab <schwab@linux-m68k.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: [PATCH] macio: don't dereference pointer before null check
Date: Tue, 01 Jun 2010 17:58:40 +0200 [thread overview]
Message-ID: <m2sk56u4lr.fsf_-_@whitebox.home> (raw)
In-Reply-To: <1275385607.1931.712.camel__30394.2679115154$1275385651$gmane$org@pasglop> (Benjamin Herrenschmidt's message of "Tue, 01 Jun 2010 19:46:47 +1000")
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
drivers/macintosh/macio_asic.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index 9714780..40390ac 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -492,8 +492,8 @@ static void macio_pci_add_devices(struct macio_chip *chip)
}
/* Add media bay devices if any */
- pnode = mbdev->ofdev.dev.of_node;
- if (mbdev)
+ if (mbdev) {
+ pnode = mbdev->ofdev.dev.of_node;
for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
if (macio_skip_device(np))
continue;
@@ -502,10 +502,11 @@ static void macio_pci_add_devices(struct macio_chip *chip)
mbdev, root_res) == NULL)
of_node_put(np);
}
+ }
/* Add serial ports if any */
- pnode = sdev->ofdev.dev.of_node;
if (sdev) {
+ pnode = sdev->ofdev.dev.of_node;
for (np = NULL; (np = of_get_next_child(pnode, np)) != NULL;) {
if (macio_skip_device(np))
continue;
--
1.7.1
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2010-06-01 15:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 1:50 [PATCH] powerpc: Don't export cvt_fd & _df when CONFIG_PPC_FPU is not set Benjamin Herrenschmidt
2010-05-31 2:00 ` Benjamin Herrenschmidt
2010-05-31 9:33 ` Alexander Graf
2010-05-31 9:52 ` Andreas Schwab
2010-05-31 15:52 ` Alexander Graf
[not found] ` <4C03DB3D.7090007__38063.9078132392$1275321190$gmane$org@suse.de>
2010-05-31 18:06 ` Andreas Schwab
2010-05-31 18:52 ` Alexander Graf
2010-06-01 9:31 ` Benjamin Herrenschmidt
[not found] ` <1275384716.1931.711.camel__10281.3212587082$1275384770$gmane$org@pasglop>
2010-06-01 9:36 ` Andreas Schwab
2010-06-01 9:46 ` Benjamin Herrenschmidt
[not found] ` <1275385607.1931.712.camel__30394.2679115154$1275385651$gmane$org@pasglop>
2010-06-01 15:58 ` Andreas Schwab [this message]
[not found] ` <m3mxvfrt5n.fsf__49359.5060579993$1275385036$gmane$org@hase.home>
2010-06-01 18:58 ` Andreas Schwab
2010-06-02 7:11 ` Benjamin Herrenschmidt
2010-05-31 10:24 ` Benjamin Herrenschmidt
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=m2sk56u4lr.fsf_-_@whitebox.home \
--to=schwab@linux-m68k.org \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).