aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorYueHaibing2019-02-19 14:57:50 +0800
committerGreg Kroah-Hartman2019-02-19 14:26:45 +0100
commit4e46f271c37415323f2b650d02ef50c87ff8d092 (patch)
treed22ec27b2a2a35735f4bb13b874a614743de89fc /drivers/usb
parentdc8b2a691dc8f25ca6764236ed27df7c87239dd9 (diff)
usb: typec: mux: Fix unsigned comparison with less than zero
The return from the call to fwnode_property_read_u16_array is int, it can be a negative error code however this is being assigned to an size_t variable 'nval', hence the check is always false. Fix this by making 'nval' an int. Detected by Coccinelle ("Unsigned expression compared with zero: nval < 0") Fixes: 96a6d031ca99 ("usb: typec: mux: Find the muxes by also matching against the device node") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/typec/mux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index a5947d98824d..54d74978df9c 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -126,7 +126,7 @@ static void *typec_mux_match(struct device_connection *con, int ep, void *data)
{
const struct typec_altmode_desc *desc = data;
struct typec_mux *mux;
- size_t nval;
+ int nval;
bool match;
u16 *val;
int i;