From: Tapasweni Pathak <tapaswenipathak@gmail.com>
To: kyungmin.park@samsung.com, a.hajda@samsung.com,
mchehab@osg.samsung.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: tapaswenipathak@gmail.com
Subject: [PATCH v2] drivers: media: i2c : s5c73m3: Fix null dereference
Date: Tue, 3 Mar 2015 08:46:10 +0530 [thread overview]
Message-ID: <20150303031610.GA25471@kt-Inspiron-3542> (raw)
Replace dev_err statement which dereferences a null with pr_err_once.
Move if(!spi_dev) above if(dir...) block.
Found using Coccinelle.
Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
---
Changes since v1:
Replace pr_err with pr_err_once.
Move if(!spi_dev).
Reword commit message.
Reword subject.
drivers/media/i2c/s5c73m3/s5c73m3-spi.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
index f60b265..376b78f 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
@@ -46,16 +46,16 @@ static int spi_xmit(struct spi_device *spi_dev, void *addr, const int len,
.len = len,
};
+ if(!spi_dev) {
+ pr_err_once("SPI device is unintialized\n");
+ return -ENODEV;
+ }
+
if (dir == SPI_DIR_TX)
xfer.tx_buf = addr;
else
xfer.rx_buf = addr;
- if (spi_dev == NULL) {
- dev_err(&spi_dev->dev, "SPI device is uninitialized\n");
- return -ENODEV;
- }
-
spi_message_init(&msg);
spi_message_add_tail(&xfer, &msg);
--
1.7.9.5
reply other threads:[~2015-03-03 3:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20150303031610.GA25471@kt-Inspiron-3542 \
--to=tapaswenipathak@gmail.com \
--cc=a.hajda@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.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
all inboxes | Powered by JetHome®