[PATCH v2] gpio: sifive: Add missing check for platform_get_irq

Andy Shevchenko andy.shevchenko at gmail.com
Sat Jun 3 13:59:46 PDT 2023


On Sat, Jun 3, 2023 at 8:48 PM kernel test robot <lkp at intel.com> wrote:
>
> Hi Jiasheng,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on brgl/gpio/for-next]
> [also build test WARNING on linus/master v6.4-rc4 next-20230602]
> [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/Jiasheng-Jiang/gpio-sifive-Add-missing-check-for-platform_get_irq/20230602-152856
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
> patch link:    https://lore.kernel.org/r/20230602072755.7314-1-jiasheng%40iscas.ac.cn
> patch subject: [PATCH v2] gpio: sifive: Add missing check for platform_get_irq
> config: openrisc-randconfig-m041-20230531 (https://download.01.org/0day-ci/archive/20230604/202306040153.RPAlkz3U-lkp@intel.com/config)
> compiler: or1k-linux-gcc (GCC) 12.3.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202306040153.RPAlkz3U-lkp@intel.com/
>
> smatch warnings:
> drivers/gpio/gpio-sifive.c:226 sifive_gpio_probe() warn: unsigned 'chip->irq_number[i]' is never less than zero.

Nice!

...

>    224          for (i = 0; i < ngpio; i++) {
>    225                  chip->irq_number[i] = platform_get_irq(pdev, i);
>  > 226                  if (chip->irq_number[i] < 0)
>    227                          return chip->irq_number[i];

So, this should be

  ret = ...
  if (ret < 0)
    return ret;
  irq_number = ret;

>    228          }


-- 
With Best Regards,
Andy Shevchenko



More information about the linux-riscv mailing list