Hi Fabio,

On Sat, Dec 06, 2014 at 01:43:52PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <[email protected]>
> 
> Commit f2d347ff70be453e ("Input: gpio_keys - add device tree support for
> interrupt only keys") caused the following build warning:
> 
> drivers/input/keyboard/gpio_keys.c: In function 'gpio_keys_probe':
> drivers/input/keyboard/gpio_keys.c:647:15: warning: 'irq' may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
> drivers/input/keyboard/gpio_keys.c:622:7: note: 'irq' was declared here
> 
> Initialize 'irq' with a default value to fix it.
> 
> Reported-by: Olof's autobuilder <[email protected]>
> Signed-off-by: Fabio Estevam <[email protected]>
> ---
>  drivers/input/keyboard/gpio_keys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c 
> b/drivers/input/keyboard/gpio_keys.c
> index aa13055..70e89d1 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -619,7 +619,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
>       i = 0;
>       for_each_child_of_node(node, pp) {
>               int gpio = -1;
> -             int irq;
> +             int irq = -EINVAL;

No, this is not good as we'll end up with button->irq, which is unsigned
int, having nonsense value.

I'd rather move assignment into the proper branch.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to