Skip to content

Commit

Permalink
misc: eeprom/idt_89hpesx: Convert data structures to LE explicitly
Browse files Browse the repository at this point in the history
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>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240131033028.3099156-1-dawei.li@shingroup.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dawei Li authored and Greg Kroah-Hartman committed Feb 18, 2024
1 parent 57a9e50 commit d0fc93f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/misc/eeprom/idt_89hpesx.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct idt_smb_seq {
struct idt_eeprom_seq {
u8 cmd;
u8 eeaddr;
u16 memaddr;
__le16 memaddr;
u8 data;
} __packed;

Expand All @@ -141,8 +141,8 @@ struct idt_eeprom_seq {
*/
struct idt_csr_seq {
u8 cmd;
u16 csraddr;
u32 data;
__le16 csraddr;
__le32 data;
} __packed;

/*
Expand Down

0 comments on commit d0fc93f

Please sign in to comment.