usb: typec: wcove: Use LE to CPU conversion when accessing msg->header
Subsystems (2)
PATCH v2 1/1 usb: typec: wcove: Use LE to CPU conversion when accessing msg->header
As LKP noticed the Sparse is not happy about strict type handling:
.../typec/tcpm/wcove.c:380:50: sparse: expected unsigned short [usertype] header
.../typec/tcpm/wcove.c:380:50: sparse: got restricted __le16 const [usertype] header
Fix this by switching to use pd_header_cnt_le() instead of pd_header_cnt() in the affected code.
---
v2: added Rb tag (Heikki), amend Fixes tags (Greg)
drivers/usb/typec/tcpm/wcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/tcpm/wcove.c +1 -1
@@ -378,7 +378,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc,const u8 *data = (void *)msg;int i; -for (i =0 ; i <pd_header_cnt (msg->header) *4 +2 ; i++) { +for (i =0 ; i <pd_header_cnt_le (msg->header) *4 +2 ; i++) { ret =regmap_write (wcove->regmap,USBC_TX_DATA + i, data[i]);if (ret)
Signature · 1 line
2.30.2
Quoted 7 lines · Andy Shevchenko
As LKP noticed the Sparse is not happy about strict type handling:
.../typec/tcpm/wcove.c:380:50: sparse: expected unsigned short [usertype] header
.../typec/tcpm/wcove.c:380:50: sparse: got restricted__le16const [usertype] headerFix this by switching to use
pd_header_cnt_le()instead ofpd_header_cnt()in the affected code.
Quoted 6 lines
Fixes ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together")Fixes 3c4fb9f16921 ("usb: typec: wcove: start using tcpm for USB PD support")Reported-by kernel test robot <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>Reviewed-by Heikki Krogerus <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 21 lines
---
v2: added Rb tag (Heikki), amend Fixes tags (Greg)drivers/usb/typec/tcpm/wcove.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/typec/tcpm/wcove.c +1
-1@@ -378,7 +378,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc,const u8 *data = (void *)msg;int i; -for (i =0 ; i <pd_header_cnt (msg->header) *4 +2 ; i++) { +for (i =0 ; i <pd_header_cnt_le (msg->header) *4 +2 ; i++) { ret =regmap_write (wcove->regmap,USBC_TX_DATA + i, data[i]);if (ret)Signature · 1 line
2.30.2