]> git.baikalelectronics.ru Git - kernel.git/commit
Input: iqs7222 - propagate some error codes correctly
authorDan Carpenter <dan.carpenter@oracle.com>
Sun, 17 Apr 2022 20:03:53 +0000 (13:03 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 17 Apr 2022 20:14:29 +0000 (13:14 -0700)
commitb234a29edb4a0e6e41249bb8873f6d3f1f9d0f63
tree6a703a35bdd9cca9d9441fc56c6f7d2b89e91227
parent27eaac94c6be4e3984aaebb133c98a43c68410dd
Input: iqs7222 - propagate some error codes correctly

If fwnode_property_count_u32() returns a negative error code then,
because of type promotion, the "count > ARRAY_SIZE(pins)" condition
will be true.  The negative "count" is type promoted to a high unsigned
size_t value.

That means the "else if (count < 0)" condition will always be false and
we don't print that error message or propagate the error code from
fwnode_property_count_u32() as intended.

Fix this by re-ordering the checks so that we check for negative first.

Fixes: 27eaac94c6be ("Input: add support for Azoteq IQS7222A/B/C")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220412153954.GA15406@kili
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/iqs7222.c