Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e37ad472 authored by YueHaibing's avatar YueHaibing Committed by Will McVicker
Browse files

UPSTREAM: 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")

Bug: 150877929
Fixes: 96a6d031ca99 ("usb: typec: mux: Find the muxes by also matching against the device node")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I3169e47b59bbe5972b79ce88f849b345a401898e
(cherry picked from commit 4e46f271c37415323f2b650d02ef50c87ff8d092)
Signed-off-by: default avatarWill McVicker <willmcvicker@google.com>
parent 0e52678a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;