drivers/power/supply/surface_charger.c:69:21: sparse: sparse: incorrect type in initializer (different base types)

From: kernel test robot
Date: Tue May 11 2021 - 01:07:44 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1140ab592e2ebf8153d2b322604031a8868ce7a5
commit: e61ffb344591fca443be4fc633290cbf15ee3298 power: supply: Add AC driver for Surface Aggregator Module
date: 5 weeks ago
config: i386-randconfig-s032-20210511 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e61ffb344591fca443be4fc633290cbf15ee3298
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e61ffb344591fca443be4fc633290cbf15ee3298
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
drivers/power/supply/surface_charger.c:31:1: sparse: sparse: symbol '__raw_ssam_bat_get_sta' was not declared. Should it be static?
drivers/power/supply/surface_charger.c:31:1: sparse: sparse: symbol 'ssam_bat_get_sta' was not declared. Should it be static?
drivers/power/supply/surface_charger.c:37:1: sparse: sparse: symbol '__raw_ssam_bat_get_psrc' was not declared. Should it be static?
drivers/power/supply/surface_charger.c:37:1: sparse: sparse: symbol 'ssam_bat_get_psrc' was not declared. Should it be static?
>> drivers/power/supply/surface_charger.c:69:21: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] old @@ got restricted __le32 [usertype] state @@
drivers/power/supply/surface_charger.c:69:21: sparse: expected unsigned int [usertype] old
drivers/power/supply/surface_charger.c:69:21: sparse: got restricted __le32 [usertype] state
>> drivers/power/supply/surface_charger.c:78:25: sparse: sparse: restricted __le32 degrades to integer
drivers/power/supply/surface_charger.c:229:1: sparse: sparse: symbol 'surface_ac_pm_ops' was not declared. Should it be static?

vim +69 drivers/power/supply/surface_charger.c

66
67 static int spwr_ac_update_unlocked(struct spwr_ac_device *ac)
68 {
> 69 u32 old = ac->state;
70 int status;
71
72 lockdep_assert_held(&ac->lock);
73
74 status = ssam_retry(ssam_bat_get_psrc, ac->sdev, &ac->state);
75 if (status < 0)
76 return status;
77
> 78 return old != ac->state;
79 }
80

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip