]> www.infradead.org Git - users/jedix/linux-maple.git/commit
usb: typec: ucsi: Only set number of plug altmodes after registration
authorJameson Thies <jthies@google.com>
Tue, 25 Jun 2024 00:46:07 +0000 (00:46 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jun 2024 14:09:10 +0000 (16:09 +0200)
commit22d96a285449ba78abeaf3e197caca46bc24f8e5
treee72491bc4c7d7725a16dcf24a1a9a7c25c6b7e4c
parent36b1235a8ae79caacd6f2bbd7120ac7860cab734
usb: typec: ucsi: Only set number of plug altmodes after registration

Move the setting of the plug's number of alternate modes into the
same condition as the plug's registration to prevent dereferencing the
connector's plug pointer while it is null.

Fixes: c313a44ac9cd ("usb: typec: ucsi: Always set number of alternate modes")
Suggested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://lore.kernel.org/r/20240625004607.3223757-1-jthies@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c