Commit 3c90c5a7 authored by Min-Hua Chen's avatar Min-Hua Chen Committed by Greg Kroah-Hartman

usb: typec: ucsi: correctly access opcode

hdr->opcode is __le32 type, use le32_to_cpu() to cast opcode
to integer in the switch..case statement to fix the following
sparse warnings:

drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer
drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer
drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer

No functional change.
Signed-off-by: default avatarMin-Hua Chen <minhuadotchen@gmail.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230523162314.114274-1-minhuadotchen@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7b7efc92
...@@ -245,7 +245,7 @@ static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv) ...@@ -245,7 +245,7 @@ static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
struct pmic_glink_ucsi *ucsi = priv; struct pmic_glink_ucsi *ucsi = priv;
const struct pmic_glink_hdr *hdr = data; const struct pmic_glink_hdr *hdr = data;
switch (hdr->opcode) { switch (le32_to_cpu(hdr->opcode)) {
case UC_UCSI_READ_BUF_REQ: case UC_UCSI_READ_BUF_REQ:
pmic_glink_ucsi_read_ack(ucsi, data, len); pmic_glink_ucsi_read_ack(ucsi, data, len);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment