All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media/tvp514x: recognize the error case in tvp514x_read_reg()
@ 2009-09-22 18:34 Sebastian Andrzej Siewior
  2009-09-23 23:41 ` Hiremath, Vaibhav
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2009-09-22 18:34 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media, Vaibhav Hiremath, Roel Kluin

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

i2c_smbus_read_byte_data() returns a negative value on error. It is very
likely to be != -1 (-EPERM).

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Noticed by strange results during signal beeing pending.

 drivers/media/video/tvp514x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tvp514x.c b/drivers/media/video/tvp514x.c
index 2443726..26b4e71 100644
--- a/drivers/media/video/tvp514x.c
+++ b/drivers/media/video/tvp514x.c
@@ -272,7 +272,7 @@ static int tvp514x_read_reg(struct v4l2_subdev *sd, u8 reg)
 read_again:
 
 	err = i2c_smbus_read_byte_data(client, reg);
-	if (err == -1) {
+	if (err < 0) {
 		if (retry <= I2C_RETRY_COUNT) {
 			v4l2_warn(sd, "Read: retry ... %d\n", retry);
 			retry++;
-- 
1.6.3.3


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

* RE: [PATCH] media/tvp514x: recognize the error case in tvp514x_read_reg()
  2009-09-22 18:34 [PATCH] media/tvp514x: recognize the error case in tvp514x_read_reg() Sebastian Andrzej Siewior
@ 2009-09-23 23:41 ` Hiremath, Vaibhav
  0 siblings, 0 replies; 2+ messages in thread
From: Hiremath, Vaibhav @ 2009-09-23 23:41 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, Mauro Carvalho Chehab; +Cc: linux-media, Roel Kluin


> -----Original Message-----
> From: Sebastian Andrzej Siewior [mailto:bigeasy@linutronix.de]
> Sent: Wednesday, September 23, 2009 12:04 AM
> To: Mauro Carvalho Chehab
> Cc: linux-media@vger.kernel.org; Hiremath, Vaibhav; Roel Kluin
> Subject: [PATCH] media/tvp514x: recognize the error case in
> tvp514x_read_reg()
> 
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 
> i2c_smbus_read_byte_data() returns a negative value on error. It is
> very
> likely to be != -1 (-EPERM).
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> Noticed by strange results during signal beeing pending.
> 
>  drivers/media/video/tvp514x.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/tvp514x.c
> b/drivers/media/video/tvp514x.c
> index 2443726..26b4e71 100644
> --- a/drivers/media/video/tvp514x.c
> +++ b/drivers/media/video/tvp514x.c
> @@ -272,7 +272,7 @@ static int tvp514x_read_reg(struct v4l2_subdev
> *sd, u8 reg)
>  read_again:
> 
>  	err = i2c_smbus_read_byte_data(client, reg);
> -	if (err == -1) {
> +	if (err < 0) {
>  		if (retry <= I2C_RETRY_COUNT) {
>  			v4l2_warn(sd, "Read: retry ... %d\n", retry);
>  			retry++;
[Hiremath, Vaibhav] Thanks Sebastian, good catch.

Acked by Vaibhav Hiremath.

Hans, can you apply this patch to your tree.

Thanks,
Vaibhav
> --
> 1.6.3.3
> 


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

end of thread, other threads:[~2009-09-23 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 18:34 [PATCH] media/tvp514x: recognize the error case in tvp514x_read_reg() Sebastian Andrzej Siewior
2009-09-23 23:41 ` Hiremath, Vaibhav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.