Re: [PATCH v2 2/2] hwmon: npcm750: add NPCM7xx PWM and Fan driver
From: kbuild test robot
Date: Tue Jun 19 2018 - 15:44:25 EST
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: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers//hwmon/npcm750-pwm-fan.c: In function 'npcm7xx_pwm_fan_probe':
>> drivers//hwmon/npcm750-pwm-fan.c:973:3: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
pr_err("PWM of_address_to_resource fail ret %d\n", ret);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/ret +973 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
Attachment:
.config.gz
Description: application/gzip