diff mbox

si2168: Fix unknown chip version message

Message ID 1406056450-16031-1-git-send-email-m.chehab@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab July 22, 2014, 7:14 p.m. UTC
At least here with my PCTV 292e, it is printing this error:

	si2168 10-0064: si2168: unkown chip version Si21170-

without a \n at the end. Probably because it is doing something
weird or firmware didn't load well. Anyway, better to print it
in hex, instead of using %c.

While here, fix the typo.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
 drivers/media/dvb-frontends/si2168.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Antti Palosaari July 23, 2014, 8:22 a.m. UTC | #1
Moikka!
It is single character formatter, not string, => no need to terminate, 
so that patch is not valid.

regards
Antti


On 07/22/2014 10:14 PM, Mauro Carvalho Chehab wrote:
> At least here with my PCTV 292e, it is printing this error:
>
> 	si2168 10-0064: si2168: unkown chip version Si21170-
>
> without a \n at the end. Probably because it is doing something
> weird or firmware didn't load well. Anyway, better to print it
> in hex, instead of using %c.
>
> While here, fix the typo.
>
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> ---
>   drivers/media/dvb-frontends/si2168.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
> index 41bdbc4d9f6c..842c4a555d01 100644
> --- a/drivers/media/dvb-frontends/si2168.c
> +++ b/drivers/media/dvb-frontends/si2168.c
> @@ -414,9 +414,8 @@ static int si2168_init(struct dvb_frontend *fe)
>   		break;
>   	default:
>   		dev_err(&s->client->dev,
> -				"%s: unkown chip version Si21%d-%c%c%c\n",
> -				KBUILD_MODNAME, cmd.args[2], cmd.args[1],
> -				cmd.args[3], cmd.args[4]);
> +				"%s: unknown chip version: 0x%04x\n",
> +				KBUILD_MODNAME, chip_id);
>   		ret = -EINVAL;
>   		goto err;
>   	}
>
Mauro Carvalho Chehab July 23, 2014, 1:18 p.m. UTC | #2
Em Wed, 23 Jul 2014 11:22:40 +0300
Antti Palosaari <crope@iki.fi> escreveu:

> Moikka!
> It is single character formatter, not string, => no need to terminate, 
> so that patch is not valid.

Well, what happened with an invalid firmware is that the first %c was
a 0x00 character, causing that the \n at the end and the others %c
to be discarded.

In other words, if you want to print the data with %c, you should be 
validating that it is a printable character before using %c.

On a separate issue, it is not "unkown" but "unknown".

Regards,
Mauro

> 
> regards
> Antti
> 
> 
> On 07/22/2014 10:14 PM, Mauro Carvalho Chehab wrote:
> > At least here with my PCTV 292e, it is printing this error:
> >
> > 	si2168 10-0064: si2168: unkown chip version Si21170-
> >
> > without a \n at the end. Probably because it is doing something
> > weird or firmware didn't load well. Anyway, better to print it
> > in hex, instead of using %c.
> >
> > While here, fix the typo.
> >
> > Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> > ---
> >   drivers/media/dvb-frontends/si2168.c | 5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
> > index 41bdbc4d9f6c..842c4a555d01 100644
> > --- a/drivers/media/dvb-frontends/si2168.c
> > +++ b/drivers/media/dvb-frontends/si2168.c
> > @@ -414,9 +414,8 @@ static int si2168_init(struct dvb_frontend *fe)
> >   		break;
> >   	default:
> >   		dev_err(&s->client->dev,
> > -				"%s: unkown chip version Si21%d-%c%c%c\n",
> > -				KBUILD_MODNAME, cmd.args[2], cmd.args[1],
> > -				cmd.args[3], cmd.args[4]);
> > +				"%s: unknown chip version: 0x%04x\n",
> > +				KBUILD_MODNAME, chip_id);
> >   		ret = -EINVAL;
> >   		goto err;
> >   	}
> >
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
index 41bdbc4d9f6c..842c4a555d01 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -414,9 +414,8 @@  static int si2168_init(struct dvb_frontend *fe)
 		break;
 	default:
 		dev_err(&s->client->dev,
-				"%s: unkown chip version Si21%d-%c%c%c\n",
-				KBUILD_MODNAME, cmd.args[2], cmd.args[1],
-				cmd.args[3], cmd.args[4]);
+				"%s: unknown chip version: 0x%04x\n",
+				KBUILD_MODNAME, chip_id);
 		ret = -EINVAL;
 		goto err;
 	}