usb: typec: ucsi: Fix the partner PD revision
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Fri, 30 Aug 2024 11:16:45 +0000 (14:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Sep 2024 08:06:15 +0000 (10:06 +0200)
commitde3d7969f6a80aa5abbbc0f39897495ae35548d0
tree5d3ba990f43c721af72012c1adce284da228a290
parente2940928115e83d707b21bf00b0db7d6c15f8341
usb: typec: ucsi: Fix the partner PD revision

The Partner PD Revision field in GET_CONNECTOR_CAPABILITY
data structure was introduced in UCSI v2.1. In
ucsi_check_connector_capability() the version was assumed to
be 2.0, and in ucsi_register_partner() the field is accessed
completely unconditionally.

Fixing the version in ucsi_check_connector_capability(), and
replacing the unconditional pd_revision assignment with a
direct call to ucsi_check_connector_capability() in
ucsi_register_port(). After this the revision is also
checked only if there is a PD contract.

Fixes: b9fccfdb4ebb ("usb: typec: ucsi: Get PD revision for partner")
Cc: stable@vger.kernel.org
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240830111645.2134301-1-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c