public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Tapasweni Pathak <tapaswenipathak@gmail.com>
Cc: kyungmin.park@samsung.com, a.hajda@samsung.com,
	mchehab@osg.samsung.com, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err
Date: Mon, 23 Feb 2015 20:54:42 -0800	[thread overview]
Message-ID: <1424753682.5342.9.camel@perches.com> (raw)
In-Reply-To: <20150224044731.GA5804@kt-Inspiron-3542>

On Tue, 2015-02-24 at 10:17 +0530, Tapasweni Pathak wrote:
> Replace dev_err statement with pr_err to fix null dereference.
> 
> Found by Coccinelle.
> 
> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
> ---
>  drivers/media/i2c/s5c73m3/s5c73m3-spi.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> index f60b265..63eb190 100644
> --- a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> +++ b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
> @@ -52,7 +52,7 @@ static int spi_xmit(struct spi_device *spi_dev, void *addr, const int len,
>  		xfer.rx_buf = addr;
> 
>  	if (spi_dev == NULL) {
> -		dev_err(&spi_dev->dev, "SPI device is uninitialized\n");
> +		pr_err("SPI device is uninitialized\n");
>  		return -ENODEV;
>  	}

It'd be better to move this above the if (dir...) block
and use ratelimit/once it too

static int spi_xmit(struct spi_device *spi_dev, void *addr, const int len,
		    enum spi_direction dir)
{
	struct spi_message msg;
	int r;
	struct spi_transfer xfer = {
		.len	= len,
	};

	if (!spi_dev) {
		pr_err_once("SPI device is uninitialized\n");
		return -ENODEV;
	}

	if (dir == SPI_DIR_TX)
		xfer.tx_buf = addr;
	else
		xfer.rx_buf = addr;

	...


      reply	other threads:[~2015-02-24  4:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  4:47 [PATCH] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err Tapasweni Pathak
2015-02-24  4:54 ` Joe Perches [this message]

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=1424753682.5342.9.camel@perches.com \
    --to=joe@perches.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 \
    --cc=tapaswenipathak@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