FROMGIT: usb: typec: tcpm: Use LE to CPU conversion when accessing msg->header
Sparse is not happy about strict type handling: .../typec/tcpm/tcpm.c:2720:27: warning: restricted __le16 degrades to integer .../typec/tcpm/tcpm.c:2814:32: warning: restricted __le16 degrades to integer Fix this by converting LE to CPU before use. Fixes:ae8a2ca8a2("usb: typec: Group all TCPCI/TCPM code together") Fixes:64f7c494a3("typec: tcpm: Add support for sink PPS related messages") Cc: stable <stable@vger.kernel.org> Cc: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210519100358.64018-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commitc58bbe3477https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I5b48ec712d6c7839e29ab03f0535a73d467df9e6
This commit is contained in:
parent
855f802610
commit
d79aca773d
1 changed files with 2 additions and 2 deletions
|
|
@ -2738,7 +2738,7 @@ static void tcpm_pd_ext_msg_request(struct tcpm_port *port,
|
|||
enum pd_ext_msg_type type = pd_header_type_le(msg->header);
|
||||
unsigned int data_size = pd_ext_header_data_size_le(msg->ext_msg.header);
|
||||
|
||||
if (!(msg->ext_msg.header & PD_EXT_HDR_CHUNKED)) {
|
||||
if (!(le16_to_cpu(msg->ext_msg.header) & PD_EXT_HDR_CHUNKED)) {
|
||||
tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
|
||||
tcpm_log(port, "Unchunked extended messages unsupported");
|
||||
return;
|
||||
|
|
@ -2832,7 +2832,7 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)
|
|||
"Data role mismatch, initiating error recovery");
|
||||
tcpm_set_state(port, ERROR_RECOVERY, 0);
|
||||
} else {
|
||||
if (msg->header & PD_HEADER_EXT_HDR)
|
||||
if (le16_to_cpu(msg->header) & PD_HEADER_EXT_HDR)
|
||||
tcpm_pd_ext_msg_request(port, msg);
|
||||
else if (cnt)
|
||||
tcpm_pd_data_request(port, msg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue