linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err
@ 2015-02-24  4:47 Tapasweni Pathak
  2015-02-24  4:54 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Tapasweni Pathak @ 2015-02-24  4:47 UTC (permalink / raw)
  To: kyungmin.park, a.hajda, mchehab, linux-media, linux-kernel
  Cc: tapaswenipathak

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;
 	}

--
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers: media: i2c : s5c73m3: Replace dev_err with pr_err
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2015-02-24  4:54 UTC (permalink / raw)
  To: Tapasweni Pathak
  Cc: kyungmin.park, a.hajda, mchehab, linux-media, linux-kernel

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;

	...


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-24  4:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).