Re: [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT K1 SoC

Dan Carpenter
2024-10-21T07:22:54Z

Hi Troy,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Troy-Mitchell/dt-bindings-i2c-spacemit-add-support-for-K1-SoC/20241015-155402
base: https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link: https://lore.kernel.org/r/20241015075134.1449458-3-TroyMitchell988%40gmail.com
patch subject: [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT K1 SoC
config: alpha-randconfig-r071-20241019 (https://download.01.org/0day-ci/archive/20241019/202410191416.NyqQCvE3-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0

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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202410191416.NyqQCvE3-lkp@intel.com/

smatch warnings:
drivers/i2c/busses/i2c-k1.c:621 spacemit_i2c_probe() warn: passing zero to 'PTR_ERR'
drivers/i2c/busses/i2c-k1.c:622 spacemit_i2c_probe() warn: passing zero to 'dev_err_probe'

vim +/PTR_ERR +621 drivers/i2c/busses/i2c-k1.c

aede17b17b7dfb Troy Mitchell 2024-10-15 604 static int spacemit_i2c_probe(struct platform_device *pdev)
aede17b17b7dfb Troy Mitchell 2024-10-15 605 {
aede17b17b7dfb Troy Mitchell 2024-10-15 606 struct spacemit_i2c_dev *i2c;
aede17b17b7dfb Troy Mitchell 2024-10-15 607 struct device_node *of_node = pdev->dev.of_node;
aede17b17b7dfb Troy Mitchell 2024-10-15 608 struct clk *clk;
aede17b17b7dfb Troy Mitchell 2024-10-15 609 int ret = 0;
aede17b17b7dfb Troy Mitchell 2024-10-15 610
aede17b17b7dfb Troy Mitchell 2024-10-15 611 i2c = devm_kzalloc(&pdev->dev,
aede17b17b7dfb Troy Mitchell 2024-10-15 612 sizeof(struct spacemit_i2c_dev),
aede17b17b7dfb Troy Mitchell 2024-10-15 613 GFP_KERNEL);
aede17b17b7dfb Troy Mitchell 2024-10-15 614 if (!i2c)
aede17b17b7dfb Troy Mitchell 2024-10-15 615 return -ENOMEM;
aede17b17b7dfb Troy Mitchell 2024-10-15 616
aede17b17b7dfb Troy Mitchell 2024-10-15 617 i2c->dev = &pdev->dev;
aede17b17b7dfb Troy Mitchell 2024-10-15 618
aede17b17b7dfb Troy Mitchell 2024-10-15 619 i2c->base = devm_platform_ioremap_resource(pdev, 0);
aede17b17b7dfb Troy Mitchell 2024-10-15 620 if (!i2c->base) {

This should be if (IS_ERR(i2c->base)) {

aede17b17b7dfb Troy Mitchell 2024-10-15 @621 ret = PTR_ERR(i2c->base);
aede17b17b7dfb Troy Mitchell 2024-10-15 @622 return dev_err_probe(&pdev->dev, ret, "failed to do ioremap");
aede17b17b7dfb Troy Mitchell 2024-10-15 623 }
aede17b17b7dfb Troy Mitchell 2024-10-15 624
aede17b17b7dfb Troy Mitchell 2024-10-15 625 i2c->irq = platform_get_irq(pdev, 0);
aede17b17b7dfb Troy Mitchell 2024-10-15 626 if (i2c->irq < 0) {
aede17b17b7dfb Troy Mitchell 2024-10-15 627 ret = i2c->irq;
aede17b17b7dfb Troy Mitchell 2024-10-15 628 return dev_err_probe(&pdev->dev, ret, "failed to get irq resource");
aede17b17b7dfb Troy Mitchell 2024-10-15 629 }
aede17b17b7dfb Troy Mitchell 2024-10-15 630
aede17b17b7dfb Troy Mitchell 2024-10-15 631 ret = devm_request_irq(i2c->dev, i2c->irq,
aede17b17b7dfb Troy Mitchell 2024-10-15 632 spacemit_i2c_irq_handler,
aede17b17b7dfb Troy Mitchell 2024-10-15 633 IRQF_NO_SUSPEND | IRQF_ONESHOT,
aede17b17b7dfb Troy Mitchell 2024-10-15 634 dev_name(i2c->dev), i2c);
aede17b17b7dfb Troy Mitchell 2024-10-15 635
aede17b17b7dfb Troy Mitchell 2024-10-15 636 if (ret)
aede17b17b7dfb Troy Mitchell 2024-10-15 637 return dev_err_probe(&pdev->dev, ret, "failed to request irq");

--
0-DAY CI Kernel Test Service