linux-4.2-rc6/drivers/extcon/extcon.c: 3 * bad tests ?

From: David Binderman
Date: Sun Aug 09 2015 - 17:35:47 EST


Hello there,

1.

[linux-4.2-rc6/drivers/extcon/extcon.c:153]: (style) Checking if unsigned variable 'id' is less than zero.

Source code is

    id = find_cable_id_by_name(edev, name);
    if (id < 0)

but

   unsigned int id;

Suggest sanity check return value from find_cable_id_by_name
*before* assigning it into an unsigned variable.

2.

[linux-4.2-rc6/drivers/extcon/extcon.c:384]: (style) Checking if unsigned variable 'id' is less than zero.

Duplicate.

3.

[linux-4.2-rc6/drivers/extcon/extcon.c:432]: (style) Checking if unsigned variable 'id' is less than zero.

Another duplicate.


Regards

David Binderman
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/