mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Usyskin <alexander.usyskin@intel.com>
To: Arnd Bergmann <arnd@arndb.de>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Badal Nilawar <badal.nilawar@intel.com>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
	Menachem Adin <menachem.adin@intel.com>,
	 Alexander Usyskin <alexander.usyskin@intel.com>,
	stable@vger.kernel.org,  kernel test robot <lkp@intel.com>
Subject: [PATCH char-misc v2] mei: lb: fix incorrect type in assignment
Date: Mon, 06 Jul 2026 16:01:30 +0300	[thread overview]
Message-ID: <20260706-fix_type_le-v2-1-586826351454@intel.com> (raw)

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 integer
drivers/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_id
drivers/misc/mei/mei_lb.c:330:40: sparse:     got int

Cc: stable@vger.kernel.org
Fixes: 773a43b8627f ("mei: lb: add late binding version 2")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605091533.79Zcv3CX-lkp@intel.com/
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
---
Changes in v2:
- Move cast to where macro is actually compared and assigned (GregKH)
- Link to v1: https://lore.kernel.org/r/20260610-fix_type_le-v1-1-15c2b08b6451@intel.com
---
 drivers/misc/mei/mei_lb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/mei/mei_lb.c b/drivers/misc/mei/mei_lb.c
index f6a258c2b838..9fa69acf28d5 100644
--- a/drivers/misc/mei/mei_lb.c
+++ b/drivers/misc/mei/mei_lb.c
@@ -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 *clde
 		if (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,
-- 
Alexander Usyskin <alexander.usyskin@intel.com>


             reply	other threads:[~2026-07-06 13:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 13:01 Alexander Usyskin [this message]
2026-07-06 14:32 ` Greg Kroah-Hartman
2026-07-07  6:43   ` Usyskin, Alexander
2026-07-07  7:21     ` Andy Shevchenko
2026-07-07  8:47       ` Greg Kroah-Hartman
2026-07-07  9:02         ` Andy Shevchenko
2026-07-07 11:33           ` Usyskin, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260706-fix_type_le-v2-1-586826351454@intel.com \
    --to=alexander.usyskin@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=badal.nilawar@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=menachem.adin@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®