drivers/hwmon/corsair-cpro.c:502:79: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Sat Dec 09 2023 - 15:53:19 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f2e8a57ee9036c7d5443382b6c3c09b51a92ec7e
commit: 40c3a445422579db8ad96c234dbe6c0ab3f6b936 hwmon: add Corsair Commander Pro driver
date: 3 years, 5 months ago
config: parisc-randconfig-m041-20230821 (https://download.01.org/0day-ci/archive/20231210/202312100455.k6m2eO4N-lkp@xxxxxxxxx/config)
compiler: hppa-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20231210/202312100455.k6m2eO4N-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312100455.k6m2eO4N-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/hwmon/corsair-cpro.c:502:79: sparse: sparse: Using plain integer as NULL pointer

vim +502 drivers/hwmon/corsair-cpro.c

460
461 static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id)
462 {
463 struct ccp_device *ccp;
464 int ret;
465
466 ccp = devm_kzalloc(&hdev->dev, sizeof(*ccp), GFP_KERNEL);
467 if (!ccp)
468 return -ENOMEM;
469
470 ccp->buffer = devm_kmalloc(&hdev->dev, OUT_BUFFER_SIZE, GFP_KERNEL);
471 if (!ccp->buffer)
472 return -ENOMEM;
473
474 ret = hid_parse(hdev);
475 if (ret)
476 return ret;
477
478 ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
479 if (ret)
480 return ret;
481
482 ret = hid_hw_open(hdev);
483 if (ret)
484 goto out_hw_stop;
485
486 ccp->hdev = hdev;
487 hid_set_drvdata(hdev, ccp);
488 mutex_init(&ccp->mutex);
489 init_completion(&ccp->wait_input_report);
490
491 hid_device_io_start(hdev);
492
493 /* temp and fan connection status only updates when device is powered on */
494 ret = get_temp_cnct(ccp);
495 if (ret)
496 goto out_hw_close;
497
498 ret = get_fan_cnct(ccp);
499 if (ret)
500 goto out_hw_close;
501 ccp->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "corsaircpro",
> 502 ccp, &ccp_chip_info, 0);
503 if (IS_ERR(ccp->hwmon_dev)) {
504 ret = PTR_ERR(ccp->hwmon_dev);
505 goto out_hw_close;
506 }
507
508 return 0;
509
510 out_hw_close:
511 hid_hw_close(hdev);
512 out_hw_stop:
513 hid_hw_stop(hdev);
514 return ret;
515 }
516

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki