Re: [PATCH v2] gpio: Return EPROBE_DEFER if gc->to_irq is NULL

From: kernel test robot
Date: Wed Nov 10 2021 - 04:16:43 EST


Hi Shreeya,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linusw-gpio/for-next]
[also build test ERROR on v5.15 next-20211110]
[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]

url: https://github.com/0day-ci/linux/commits/Shreeya-Patel/gpio-Return-EPROBE_DEFER-if-gc-to_irq-is-NULL/20211019-060640
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: sh-rsk7269_defconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e807153b3cae5acb6d78393087c28e4004cb9856
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shreeya-Patel/gpio-Return-EPROBE_DEFER-if-gc-to_irq-is-NULL/20211019-060640
git checkout e807153b3cae5acb6d78393087c28e4004cb9856
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/gpio/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

cc1: warning: arch/sh/include/mach-rsk: No such file or directory [-Wmissing-include-dirs]
cc1: warning: arch/sh/include/mach-rsk: No such file or directory [-Wmissing-include-dirs]
drivers/gpio/gpiolib.c: In function 'gpiod_to_irq':
>> drivers/gpio/gpiolib.c:3068:15: error: 'struct gpio_chip' has no member named 'irq'
3068 | if (gc->irq.chip) {
| ^~


vim +3068 drivers/gpio/gpiolib.c

3036
3037 /**
3038 * gpiod_to_irq() - return the IRQ corresponding to a GPIO
3039 * @desc: gpio whose IRQ will be returned (already requested)
3040 *
3041 * Return the IRQ corresponding to the passed GPIO, or an error code in case of
3042 * error.
3043 */
3044 int gpiod_to_irq(const struct gpio_desc *desc)
3045 {
3046 struct gpio_chip *gc;
3047 int offset;
3048
3049 /*
3050 * Cannot VALIDATE_DESC() here as gpiod_to_irq() consumer semantics
3051 * requires this function to not return zero on an invalid descriptor
3052 * but rather a negative error number.
3053 */
3054 if (!desc || IS_ERR(desc) || !desc->gdev || !desc->gdev->chip)
3055 return -EINVAL;
3056
3057 gc = desc->gdev->chip;
3058 offset = gpio_chip_hwgpio(desc);
3059 if (gc->to_irq) {
3060 int retirq = gc->to_irq(gc, offset);
3061
3062 /* Zero means NO_IRQ */
3063 if (!retirq)
3064 return -ENXIO;
3065
3066 return retirq;
3067 }
> 3068 if (gc->irq.chip) {
3069 /* avoid race condition with other code, which tries to lookup
3070 * an IRQ before the irqchip has been properly registered
3071 * (i.e. while gpiochip is still being brought up).
3072 */
3073 return -EPROBE_DEFER;
3074 }
3075
3076 return -ENXIO;
3077 }
3078 EXPORT_SYMBOL_GPL(gpiod_to_irq);
3079

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip