[PATCH v2 2/2] hwmon: npcm750: add NPCM7xx PWM and Fan driver

kbuild test robot lkp at intel.com
Wed Jun 20 00:31:51 AEST 2018


Hi Tomer,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on v4.18-rc1 next-20180619]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Tomer-Maimon/hwmon-Add-NPCM7xx-PWM-and-Fan-driver-support/20180619-192033
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=ia64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:332,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/hwmon/npcm750-pwm-fan.c:4:
   drivers/hwmon/npcm750-pwm-fan.c: In function 'npcm7xx_pwm_fan_probe':
>> drivers/hwmon/npcm750-pwm-fan.c:979:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (u32)data->pwm_base, res->start, resource_size(res));
       ^
   include/linux/dynamic_debug.h:128:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:978:2: note: in expansion of macro 'pr_debug'
     pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
   In file included from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/hwmon/npcm750-pwm-fan.c:4:
>> drivers/hwmon/npcm750-pwm-fan.c:978:11: warning: format '%X' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:978:2: note: in expansion of macro 'pr_debug'
     pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:978:11: warning: format '%X' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:978:2: note: in expansion of macro 'pr_debug'
     pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
   In file included from include/linux/printk.h:332,
                    from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/hwmon/npcm750-pwm-fan.c:4:
   drivers/hwmon/npcm750-pwm-fan.c:999:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       (u32)data->fan_base, res->start, resource_size(res));
       ^
   include/linux/dynamic_debug.h:128:10: note: in definition of macro 'dynamic_pr_debug'
           ##__VA_ARGS__);  \
             ^~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:998:2: note: in expansion of macro 'pr_debug'
     pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
   In file included from include/linux/kernel.h:14,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from drivers/hwmon/npcm750-pwm-fan.c:4:
   drivers/hwmon/npcm750-pwm-fan.c:998:11: warning: format '%X' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:998:2: note: in expansion of macro 'pr_debug'
     pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:998:11: warning: format '%X' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:288:21: note: in definition of macro 'pr_fmt'
    #define pr_fmt(fmt) fmt
                        ^~~
   include/linux/printk.h:336:2: note: in expansion of macro 'dynamic_pr_debug'
     dynamic_pr_debug(fmt, ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:998:2: note: in expansion of macro 'pr_debug'
     pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
     ^~~~~~~~
>> include/linux/printk.h:304:2: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
     printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~
   drivers/hwmon/npcm750-pwm-fan.c:961:6: note: 'ret' was declared here
     int ret, cnt;
         ^~~

vim +979 drivers/hwmon/npcm750-pwm-fan.c

   952	
   953	static int npcm7xx_pwm_fan_probe(struct platform_device *pdev)
   954	{
   955		struct device *dev = &pdev->dev;
   956		struct device_node *np, *child;
   957		struct npcm7xx_pwm_fan_data *data;
   958		struct resource *res;
   959		struct device *hwmon;
   960		char name[20];
   961		int ret, cnt;
   962		u32 output_freq;
   963		u32 i;
   964	
   965		np = dev->of_node;
   966	
   967		data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
   968		if (!data)
   969			return -ENOMEM;
   970	
   971		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm_base");
   972		if (res == NULL) {
   973			pr_err("PWM of_address_to_resource fail ret %d\n", ret);
   974			return -ENODEV;
   975		}
   976	
   977		data->pwm_base = devm_ioremap_resource(dev, res);
 > 978		pr_debug("pwm base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
 > 979			 (u32)data->pwm_base, res->start, resource_size(res));
   980		if (!data->pwm_base) {
   981			pr_err("pwm probe failed: can't read pwm base address\n");
   982			return -ENOMEM;
   983		}
   984	
   985		data->pwm_clk = devm_clk_get(dev, "clk_apb3");
   986		if (IS_ERR(data->pwm_clk)) {
   987			pr_err(" pwm probe failed: can't read clk.\n");
   988			return -ENODEV;
   989		}
   990	
   991		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fan_base");
   992		if (ret) {
   993			pr_err("fan of_address_to_resource fail ret %d\n", ret);
   994			return -ENODEV;
   995		}
   996	
   997		data->fan_base = devm_ioremap_resource(dev, res);
   998		pr_debug("fan base is 0x%08X, res.start 0x%08X , size 0x%08X\n",
   999			 (u32)data->fan_base, res->start, resource_size(res));
  1000	
  1001		if (!data->fan_base) {
  1002			pr_err("fan probe failed: can't read fan base address.\n");
  1003			return -ENOMEM;
  1004		}
  1005	
  1006		data->fan_clk = devm_clk_get(dev, "clk_apb4");
  1007		if (IS_ERR(data->fan_clk)) {
  1008			pr_err(" FAN probe failed: can't read clk.\n");
  1009			return -ENODEV;
  1010		}
  1011	
  1012		output_freq = npcm7xx_pwm_init(data);
  1013		npcm7xx_fan_init(data);
  1014	
  1015		for (cnt = 0; cnt < NPCM7XX_PWM_MAX_MODULES  ; cnt++)
  1016			mutex_init(&data->npcm7xx_pwm_lock[cnt]);
  1017	
  1018		for (i = 0; i < NPCM7XX_FAN_MAX_MODULE; i++) {
  1019			spin_lock_init(&data->npcm7xx_fan_lock[i]);
  1020	
  1021			data->fan_irq[i] = platform_get_irq(pdev, i);
  1022			if (!data->fan_irq[i]) {
  1023				pr_err("%s - failed to map irq %d\n", __func__, i);
  1024				ret = -EAGAIN;
  1025				goto err_irq;
  1026			}
  1027	
  1028			sprintf(name, "NPCM7XX-FAN-MD%d", i);
  1029	
  1030			if (request_irq(data->fan_irq[i], npcm7xx_fan_isr, 0, name,
  1031					(void *)data)) {
  1032				pr_err("NPCM7XX: register irq FAN%d failed\n", i);
  1033				ret = -EAGAIN;
  1034				goto err_irq;
  1035			}
  1036		}
  1037	
  1038		for_each_child_of_node(np, child) {
  1039			ret = npcm7xx_en_pwm_fan(dev, child, data);
  1040			if (ret) {
  1041				pr_err("npcm7xx_en_pwm_fan failed ret %d\n", ret);
  1042				of_node_put(child);
  1043				goto err_irq;
  1044			}
  1045		}
  1046	
  1047		hwmon = devm_hwmon_device_register_with_info(dev, "npcm7xx_pwm_fan",
  1048							     data, &npcm7xx_chip_info,
  1049							     NULL);
  1050		if (IS_ERR(hwmon)) {
  1051			pr_err("PWM Driver failed - devm_hwmon_device_register_with_groups failed\n");
  1052			ret =  PTR_ERR(hwmon);
  1053			goto err_irq;
  1054		}
  1055	
  1056		for (i = 0; i < NPCM7XX_FAN_MAX_CHN_NUM; i++) {
  1057			if (data->fan_present[i] == true) {
  1058				/* fan timer initialization */
  1059				data->npcm7xx_fan_select = 0;
  1060				data->npcm7xx_fan_timer.expires = jiffies +
  1061					msecs_to_jiffies(NPCM7XX_FAN_POLL_TIMER_200MS);
  1062				timer_setup(&data->npcm7xx_fan_timer,
  1063					    npcm7xx_fan_polling, 0);
  1064				add_timer(&data->npcm7xx_fan_timer);
  1065				break;
  1066			}
  1067		}
  1068	
  1069		pr_info("NPCM7XX PWM-FAN Driver probed, output Freq %dHz[PWM], input Freq %dHz[FAN]\n",
  1070			output_freq, data->InputClkFreq);
  1071	
  1072		return 0;
  1073	
  1074	err_irq:
  1075		for (; i > 0; i--)
  1076			free_irq(data->fan_irq[i-1], (void *)data);
  1077	
  1078		return ret;
  1079	}
  1080	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 50920 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20180619/3ad47815/attachment-0001.gz>


More information about the openbmc mailing list