Skip to content

Commit 65c4c94

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: ucsi: Fix a missing bits to bytes conversion in ucsi_init()
The GET_CAPABILITY size is wrong. The definitions for the command sizes are for bitfieds and therefore in bits, not bytes. This fixes an issue that prevents the interface from being registered with UCSI versions older than 2.0 because the command size exceeds the MESSAGE_IN field size. Fixes: 226ff2e ("usb: typec: ucsi: Convert connector specific commands to bitmaps") Reported-by: Abel Vesa <[email protected]> Closes: https://lore.kernel.org/linux-usb/[email protected]/ Signed-off-by: Heikki Krogerus <[email protected]> Reviewed-by: Abel Vesa <[email protected]> Tested-by: Abel Vesa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3fc1373 commit 65c4c94

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/usb/typec/ucsi/ucsi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,8 @@ static int ucsi_init(struct ucsi *ucsi)
17751775

17761776
/* Get PPM capabilities */
17771777
command = UCSI_GET_CAPABILITY;
1778-
ret = ucsi_send_command(ucsi, command, &ucsi->cap, UCSI_GET_CAPABILITY_SIZE);
1778+
ret = ucsi_send_command(ucsi, command, &ucsi->cap,
1779+
BITS_TO_BYTES(UCSI_GET_CAPABILITY_SIZE));
17791780
if (ret < 0)
17801781
goto err_reset;
17811782

0 commit comments

Comments
 (0)