From: Greg Kroah-Hartman Date: Sun, 30 May 2021 11:19:46 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.4.271~82 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12bc99b2b1f0ed037c5a0d15346cc390d38afdec;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: usb-typec-mux-fix-matching-with-typec_altmode_desc.patch --- diff --git a/queue-5.10/series b/queue-5.10/series index 436df239e02..3468b05ea09 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -85,3 +85,4 @@ usb-serial-pl2303-add-device-id-for-adlink-nd-6530-gc.patch thermal-drivers-intel-initialize-rw-trip-to-thermal_temp_invalid.patch usb-dwc3-gadget-properly-track-pending-and-queued-sg.patch usb-gadget-udc-renesas_usb3-fix-a-race-in-usb3_start_pipen.patch +usb-typec-mux-fix-matching-with-typec_altmode_desc.patch diff --git a/queue-5.10/usb-typec-mux-fix-matching-with-typec_altmode_desc.patch b/queue-5.10/usb-typec-mux-fix-matching-with-typec_altmode_desc.patch new file mode 100644 index 00000000000..9fc55148afa --- /dev/null +++ b/queue-5.10/usb-typec-mux-fix-matching-with-typec_altmode_desc.patch @@ -0,0 +1,51 @@ +From acf5631c239dfc53489f739c4ad47f490c5181ff Mon Sep 17 00:00:00 2001 +From: Bjorn Andersson +Date: Sat, 15 May 2021 20:47:30 -0700 +Subject: usb: typec: mux: Fix matching with typec_altmode_desc + +From: Bjorn Andersson + +commit acf5631c239dfc53489f739c4ad47f490c5181ff upstream. + +In typec_mux_match() "nval" is assigned the number of elements in the +"svid" fwnode property, then the variable is used to store the success +of the read and finally attempts to loop between 0 and "success" - i.e. +not at all - and the code returns indicating that no match was found. + +Fix this by using a separate variable to track the success of the read, +to allow the loop to get a change to find a match. + +Fixes: 96a6d031ca99 ("usb: typec: mux: Find the muxes by also matching against the device node") +Reviewed-by: Heikki Krogerus +Cc: stable +Signed-off-by: Bjorn Andersson +Link: https://lore.kernel.org/r/20210516034730.621461-1-bjorn.andersson@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/mux.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/usb/typec/mux.c ++++ b/drivers/usb/typec/mux.c +@@ -191,6 +191,7 @@ static void *typec_mux_match(struct fwno + bool match; + int nval; + u16 *val; ++ int ret; + int i; + + /* +@@ -218,10 +219,10 @@ static void *typec_mux_match(struct fwno + if (!val) + return ERR_PTR(-ENOMEM); + +- nval = fwnode_property_read_u16_array(fwnode, "svid", val, nval); +- if (nval < 0) { ++ ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval); ++ if (ret < 0) { + kfree(val); +- return ERR_PTR(nval); ++ return ERR_PTR(ret); + } + + for (i = 0; i < nval; i++) {