All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 04/15] [media] dvb: fix decimal printf format specifiers prefixed with 0x
@ 2014-08-06  4:42 Hans Wennborg
  2014-08-06 14:56 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Wennborg @ 2014-08-06  4:42 UTC (permalink / raw)
  To: m.chehab, linux-media, linux-kernel; +Cc: Hans Wennborg

The prefix suggests the number should be printed in hex, so use
the %x specifier to do that.

Found by using regex suggested by Joe Perches.

Signed-off-by: Hans Wennborg <hans@hanshq.net>
---
 drivers/media/dvb-frontends/mb86a16.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
index 9ae40ab..5939133 100644
--- a/drivers/media/dvb-frontends/mb86a16.c
+++ b/drivers/media/dvb-frontends/mb86a16.c
@@ -115,7 +115,7 @@ static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
 	};
 	ret = i2c_transfer(state->i2c_adap, msg, 2);
 	if (ret != 2) {
-		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%i)",
+		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%x)",
 			reg, ret);
 
 		return -EREMOTEIO;
-- 
2.0.0.526.g5318336


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

* Re: [PATCH 04/15] [media] dvb: fix decimal printf format specifiers prefixed with 0x
  2014-08-06  4:42 [PATCH 04/15] [media] dvb: fix decimal printf format specifiers prefixed with 0x Hans Wennborg
@ 2014-08-06 14:56 ` Mauro Carvalho Chehab
  2014-08-07  5:41   ` [PATCH 1/2] [media] dvb: remove 0x prefix from decimal value in printf Hans Wennborg
  2014-08-07  5:42   ` [PATCH 2/2] [media] dvb: return the error from i2c_transfer if negative Hans Wennborg
  0 siblings, 2 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2014-08-06 14:56 UTC (permalink / raw)
  To: Hans Wennborg; +Cc: linux-media, linux-kernel

Em Tue, 05 Aug 2014 21:42:17 -0700
Hans Wennborg <hans@hanshq.net> escreveu:

> The prefix suggests the number should be printed in hex, so use
> the %x specifier to do that.
> 
> Found by using regex suggested by Joe Perches.
> 
> Signed-off-by: Hans Wennborg <hans@hanshq.net>
> ---
>  drivers/media/dvb-frontends/mb86a16.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
> index 9ae40ab..5939133 100644
> --- a/drivers/media/dvb-frontends/mb86a16.c
> +++ b/drivers/media/dvb-frontends/mb86a16.c
> @@ -115,7 +115,7 @@ static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
>  	};
>  	ret = i2c_transfer(state->i2c_adap, msg, 2);
>  	if (ret != 2) {
> -		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%i)",
> +		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%x)",
>  			reg, ret);

Hmm... returning it in hex doesn't make much sense. the better would
be to remove the "0x" prefix here...

>  
>  		return -EREMOTEIO;

Btw, what we're doing on modern drivers is to return the error
as reported by i2c_transfer if it is negative. So, the best would be
to do:
	if (ret < 0)
		return ret;
	return -EREMOTEIO;

Thanks,
Mauro

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

* [PATCH 1/2] [media] dvb: remove 0x prefix from decimal value in printf
  2014-08-06 14:56 ` Mauro Carvalho Chehab
@ 2014-08-07  5:41   ` Hans Wennborg
  2014-08-07  5:42   ` [PATCH 2/2] [media] dvb: return the error from i2c_transfer if negative Hans Wennborg
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Wennborg @ 2014-08-07  5:41 UTC (permalink / raw)
  To: m.chehab, linux-media, linux-kernel; +Cc: Hans Wennborg

Signed-off-by: Hans Wennborg <hans@hanshq.net>
---
 drivers/media/dvb-frontends/mb86a16.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
index 9ae40ab..1f7fce7 100644
--- a/drivers/media/dvb-frontends/mb86a16.c
+++ b/drivers/media/dvb-frontends/mb86a16.c
@@ -115,7 +115,7 @@ static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
 	};
 	ret = i2c_transfer(state->i2c_adap, msg, 2);
 	if (ret != 2) {
-		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=0x%i)",
+		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=%i)",
 			reg, ret);
 
 		return -EREMOTEIO;
-- 
2.0.0.526.g5318336


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

* [PATCH 2/2] [media] dvb: return the error from i2c_transfer if negative
  2014-08-06 14:56 ` Mauro Carvalho Chehab
  2014-08-07  5:41   ` [PATCH 1/2] [media] dvb: remove 0x prefix from decimal value in printf Hans Wennborg
@ 2014-08-07  5:42   ` Hans Wennborg
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Wennborg @ 2014-08-07  5:42 UTC (permalink / raw)
  To: m.chehab, linux-media, linux-kernel; +Cc: Hans Wennborg

Signed-off-by: Hans Wennborg <hans@hanshq.net>
---
 drivers/media/dvb-frontends/mb86a16.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
index 1f7fce7..0e65d35 100644
--- a/drivers/media/dvb-frontends/mb86a16.c
+++ b/drivers/media/dvb-frontends/mb86a16.c
@@ -118,6 +118,8 @@ static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
 		dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=%i)",
 			reg, ret);
 
+		if (ret < 0)
+			return ret;
 		return -EREMOTEIO;
 	}
 	*val = b1[0];
-- 
2.0.0.526.g5318336


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

end of thread, other threads:[~2014-08-07  5:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06  4:42 [PATCH 04/15] [media] dvb: fix decimal printf format specifiers prefixed with 0x Hans Wennborg
2014-08-06 14:56 ` Mauro Carvalho Chehab
2014-08-07  5:41   ` [PATCH 1/2] [media] dvb: remove 0x prefix from decimal value in printf Hans Wennborg
2014-08-07  5:42   ` [PATCH 2/2] [media] dvb: return the error from i2c_transfer if negative Hans Wennborg

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.