2015-04-18 03:43:46

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH] Input: elants_i2c - zero-extend hardware ID in firmware name

Let's zero-extend hardware id number when forming firmware file name,
to avoid kernel requesting firmware like "elants_i2c_ 0.bin", which
is quite unexpected.

Signed-off-by: Dmitry Torokhov <[email protected]>
---
drivers/input/touchscreen/elants_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 43b3c9c..0efd766 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -699,7 +699,7 @@ static int elants_i2c_fw_update(struct elants_data *ts)
char *fw_name;
int error;

- fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%4x.bin", ts->hw_version);
+ fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%04x.bin", ts->hw_version);
if (!fw_name)
return -ENOMEM;

--
2.2.0.rc0.207.ga3a616c


--
Dmitry


2015-04-20 17:02:56

by Charlie Mooney

[permalink] [raw]
Subject: Re: [PATCH] Input: elants_i2c - zero-extend hardware ID in firmware name

On Fri, Apr 17, 2015 at 8:43 PM, Dmitry Torokhov
<[email protected]> wrote:
> Let's zero-extend hardware id number when forming firmware file name,
> to avoid kernel requesting firmware like "elants_i2c_ 0.bin", which
> is quite unexpected.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>
> ---
> drivers/input/touchscreen/elants_i2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
> index 43b3c9c..0efd766 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -699,7 +699,7 @@ static int elants_i2c_fw_update(struct elants_data *ts)
> char *fw_name;
> int error;
>
> - fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%4x.bin", ts->hw_version);
> + fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%04x.bin", ts->hw_version);
> if (!fw_name)
> return -ENOMEM;
>
> --
> 2.2.0.rc0.207.ga3a616c
>
>
> --
> Dmitry

Looks good to me.

Acked-by: Charlie Mooney<[email protected]>

2015-04-20 19:27:14

by Benson Leung

[permalink] [raw]
Subject: Re: [PATCH] Input: elants_i2c - zero-extend hardware ID in firmware name

On Fri, Apr 17, 2015 at 8:43 PM, Dmitry Torokhov
<[email protected]> wrote:
> Let's zero-extend hardware id number when forming firmware file name,
> to avoid kernel requesting firmware like "elants_i2c_ 0.bin", which
> is quite unexpected.
>
> Signed-off-by: Dmitry Torokhov <[email protected]>
Reviewed-by: Benson Leung <[email protected]>

--
Benson Leung
Software Engineer, Chrom* OS
[email protected]