Re: [PATCH v2 1/2] iio: adc: vf610_adc: use devm_* and dev_err_probe() to simple code

From: kernel test robot
Date: Wed Nov 06 2024 - 18:16:54 EST


Hi Frank,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on next-20241106]
[cannot apply to linus/master v6.12-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/iio-adc-vf610_adc-limit-i-MX6SX-s-channel-number-to-4/20241106-001101
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20241105160822.2761261-1-Frank.Li%40nxp.com
patch subject: [PATCH v2 1/2] iio: adc: vf610_adc: use devm_* and dev_err_probe() to simple code
config: i386-randconfig-141-20241107 (https://download.01.org/0day-ci/archive/20241107/202411070633.NIrO7Ert-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

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/202411070633.NIrO7Ert-lkp@xxxxxxxxx/

smatch warnings:
drivers/iio/adc/vf610_adc.c:857 vf610_adc_probe() warn: unsigned 'info->vref_uv' is never less than zero.

vim +857 drivers/iio/adc/vf610_adc.c

816
817 static int vf610_adc_probe(struct platform_device *pdev)
818 {
819 struct device *dev = &pdev->dev;
820 struct vf610_adc *info;
821 struct iio_dev *indio_dev;
822 int irq;
823 int ret;
824
825 indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct vf610_adc));
826 if (!indio_dev)
827 return dev_err_probe(&pdev->dev, -ENOMEM, "Failed allocating iio device\n");
828
829 info = iio_priv(indio_dev);
830 info->dev = &pdev->dev;
831
832 info->regs = devm_platform_ioremap_resource(pdev, 0);
833 if (IS_ERR(info->regs))
834 return PTR_ERR(info->regs);
835
836 irq = platform_get_irq(pdev, 0);
837 if (irq < 0)
838 return irq;
839
840 ret = devm_request_irq(info->dev, irq,
841 vf610_adc_isr, 0,
842 dev_name(&pdev->dev), indio_dev);
843 if (ret < 0)
844 dev_err_probe(&pdev->dev, ret, "failed requesting irq, irq = %d\n", irq);
845
846 info->clk = devm_clk_get_enabled(&pdev->dev, "adc");
847 if (IS_ERR(info->clk))
848 return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
849 "failed getting clock, err = %ld\n",
850 PTR_ERR(info->clk));
851
852 info->vref = devm_regulator_get(&pdev->dev, "vref");
853 if (IS_ERR(info->vref))
854 return PTR_ERR(info->vref);
855
856 info->vref_uv = devm_regulator_get_enable_read_voltage(&pdev->dev, "vref");
> 857 if (info->vref_uv < 0)
858 return info->vref_uv;
859
860 device_property_read_u32_array(dev, "fsl,adck-max-frequency", info->max_adck_rate, 3);
861
862 info->adc_feature.default_sample_time = DEFAULT_SAMPLE_TIME;
863 device_property_read_u32(dev, "min-sample-time", &info->adc_feature.default_sample_time);
864
865 platform_set_drvdata(pdev, indio_dev);
866
867 init_completion(&info->completion);
868
869 indio_dev->name = dev_name(&pdev->dev);
870 indio_dev->info = &vf610_adc_iio_info;
871 indio_dev->modes = INDIO_DIRECT_MODE;
872 indio_dev->channels = vf610_adc_iio_channels;
873 indio_dev->num_channels = ARRAY_SIZE(vf610_adc_iio_channels);
874
875 vf610_adc_cfg_init(info);
876 vf610_adc_hw_init(info);
877
878 ret = devm_iio_triggered_buffer_setup(&pdev->dev, indio_dev, &iio_pollfunc_store_time,
879 NULL, &iio_triggered_buffer_setup_ops);
880 if (ret < 0)
881 return dev_err_probe(&pdev->dev, ret, "Couldn't initialise the buffer\n");
882
883 mutex_init(&info->lock);
884
885 ret = devm_iio_device_register(&pdev->dev, indio_dev);
886 if (ret)
887 return dev_err_probe(&pdev->dev, ret, "Couldn't register the device.\n");
888
889 return 0;
890 }
891

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