]> git.baikalelectronics.ru Git - kernel.git/commit
usb: typec: mux: Fix matching with typec_altmode_desc
authorBjorn Andersson <bjorn.andersson@linaro.org>
Sun, 16 May 2021 03:47:30 +0000 (20:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 May 2021 12:26:42 +0000 (14:26 +0200)
commit8b94acadade01a7443ca5c6bc1ab03b763366698
treef345b24c2632ef2d31fdd2df8f9dd1db48e1d660
parent4429c57a5ea42349f7bfdbf7a3ea0965715a1315
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.

Fixes: 1aafaa2bbd52 ("usb: typec: mux: Find the muxes by also matching against the device node")
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210516034730.621461-1-bjorn.andersson@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/mux.c