mei: lb: fix incorrect type in assignment
Subsystems (2)
Alexander Usyskin
maintainerPATCH v3 1/1 mei: lb: fix incorrect type in assignment
Fix the mix between __le32 and integer by casting the MEI_LB2_CMD constant as __le32 while using it.
Fixes sparse waring:drivers/misc/mei/mei_lb.c:284:32: sparse: sparse: restricted __le32 degrades to integerdrivers/misc/mei/mei_lb.c:330:40: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] command_id @@ got int @@drivers/misc/mei/mei_lb.c:330:40: sparse: expected restricted __le32 [usertype] command_iddrivers/misc/mei/mei_lb.c:330:40: sparse: got int
---
Changes in v3:
- Drop cc: stable
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Move cast to where macro is actually compared and assigned (GregKH)
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/misc/mei/mei_lb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/mei_lb.c +2 -2
@@ -281,7 +281,7 @@ static int mei_lb_check_response_v2(const struct device *dev, ssize_t bytes, bytes, sizeof(rsp->rheader));return -ENOMSG ; } -if (rsp->rheader.header.command_id !=MEI_LB2_CMD ) { +if (rsp->rheader.header.command_id !=cpu_to_le32 (MEI_LB2_CMD )) {dev_err (dev,"Mismatch command: 0x%x instead of 0x%x\n" , rsp->rheader.header.command_id,MEI_LB2_CMD );return -EPROTO ;
@@ -327,7 +327,7 @@ static int mei_lb_push_payload_v2(struct device *dev, struct mei_cl_device *cldeif (sent_data + chunk_size == payload_size) last_chunk =MEI_LB2_FLAG_LST_CHUNK ; - req->header.command_id =MEI_LB2_CMD ; + req->header.command_id =cpu_to_le32 (MEI_LB2_CMD ); req->type =cpu_to_le32 (type); req->flags =cpu_to_le32 (flags | first_chunk | last_chunk); req->reserved =0 ;
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260603-fix_type_le-0184c7ed2399
Best regards,
Signature · 1 line
Alexander Usyskin <[email protected]>