patch "usb: typec: mux: Fix matching with typec_altmode_desc" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: typec: mux: Fix matching with typec_altmode_desc
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From acf5631c239dfc53489f739c4ad47f490c5181ff Mon Sep 17 00:00:00 2001
From: Bjorn Andersson <[email protected]>
Date: Sat, 15 May 2021 20:47:30 -0700
Subject: usb: typec: mux: Fix matching with typec_altmode_desc
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.
--- drivers/usb/typec/mux.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/typec/mux.c +4 -3
@@ -191,6 +191,7 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id,bool match;int nval;u16 *val; +int ret;int i;/*
@@ -218,10 +219,10 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id,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++) {
Signature · 1 line
2.31.1