mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] misc: eeprom/idt_89hpesx: Convert data structures to LE explicitly
@ 2024-01-31  3:30 Dawei Li
  2024-02-14 10:05 ` Dawei Li
  2024-02-14 10:17 ` Arnd Bergmann
  0 siblings, 2 replies; 3+ messages in thread
From: Dawei Li @ 2024-01-31  3:30 UTC (permalink / raw)
  To: arnd, gregkh; +Cc: fancer.lancer, lkp, linux-kernel, set_pte_at, Dawei Li

Kernel test robot reports following sparse warnings:
>> drivers/misc/eeprom/idt_89hpesx.c:599:31: sparse: sparse:
   incorrect type in assignment (different base types) @@
   expected unsigned short [addressable] [assigned] [usertype]
   memaddr @@     got restricted __le16 [usertype] @@

   drivers/misc/eeprom/idt_89hpesx.c:599:31: sparse:
   expected unsigned short [addressable] [assigned] [usertype]
   memaddr

   drivers/misc/eeprom/idt_89hpesx.c:599:31: sparse:
   restricted __le16 [usertype]

   .....

For data structures needs cpu_to_le* conversion, their prototype need
to be declared with __le* explicitly.

Declare data structures to __le* explicitly to address the issue:
- struct idt_eeprom_seq::memaddr
- struct idt_csr_seq::csraddr
- struct idt_csr_seq::data

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401261250.b07Yt30Z-lkp@intel.com/
Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
---
v1 -> v2:
- Add sparse warning info from Kernel test robot.
- Remove Fixes & cc stable tag.
- Add Reviewed-by from Serge.

v1: https://lore.kernel.org/all/20240130040632.3039911-1-dawei.li@shingroup.cn/

 drivers/misc/eeprom/idt_89hpesx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c
index d807d08e2614..327afb866b21 100644
--- a/drivers/misc/eeprom/idt_89hpesx.c
+++ b/drivers/misc/eeprom/idt_89hpesx.c
@@ -129,7 +129,7 @@ struct idt_smb_seq {
 struct idt_eeprom_seq {
 	u8 cmd;
 	u8 eeaddr;
-	u16 memaddr;
+	__le16 memaddr;
 	u8 data;
 } __packed;
 
@@ -141,8 +141,8 @@ struct idt_eeprom_seq {
  */
 struct idt_csr_seq {
 	u8 cmd;
-	u16 csraddr;
-	u32 data;
+	__le16 csraddr;
+	__le32 data;
 } __packed;
 
 /*
-- 
2.27.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-14 10:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-31  3:30 [PATCH v2] misc: eeprom/idt_89hpesx: Convert data structures to LE explicitly Dawei Li
2024-02-14 10:05 ` Dawei Li
2024-02-14 10:17 ` Arnd Bergmann

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®