* [brgl:gpio/for-next 5/8] drivers/gpio/gpio-altera.c:224:11: warning: comparison between pointer and integer ('struct gpio_irq_chip *' and 'int')
@ 2026-09-03 7:34 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-03 7:34 UTC (permalink / raw)
To: bui duc phuc; +Cc: llvm, oe-kbuild-all, linux-gpio, Bartosz Golaszewski
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
head: 1900b5a41493e7050c68c1e62780d6fb9a209457
commit: 6e6e585b603e4f679c2a33c8f0954ec88b52fd7a [5/8] gpio: altera: Handle errors from optional IRQ lookup
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20260903/202609031554.tpxA67sB-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project ed1626b9d0eaf7c406f44da5fb595ad94559f54b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260903/202609031554.tpxA67sB-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609031554.tpxA67sB-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/gpio/gpio-altera.c:224:7: error: use of undeclared identifier 'irq'; did you mean 'girq'?
224 | if (irq != -ENXIO)
| ^~~
| girq
drivers/gpio/gpio-altera.c:174:24: note: 'girq' declared here
174 | struct gpio_irq_chip *girq;
| ^
>> drivers/gpio/gpio-altera.c:224:11: warning: comparison between pointer and integer ('struct gpio_irq_chip *' and 'int') [-Wpointer-integer-compare]
224 | if (irq != -ENXIO)
| ~~~ ^ ~~~~~~
drivers/gpio/gpio-altera.c:225:11: error: use of undeclared identifier 'irq'; did you mean 'girq'?
225 | return irq;
| ^~~
| girq
drivers/gpio/gpio-altera.c:174:24: note: 'girq' declared here
174 | struct gpio_irq_chip *girq;
| ^
drivers/gpio/gpio-altera.c:225:11: error: incompatible pointer to integer conversion returning 'struct gpio_irq_chip *' from a function with result type 'int' [-Wint-conversion]
225 | return irq;
| ^~~
1 warning and 3 errors generated.
vim +224 drivers/gpio/gpio-altera.c
165
166 static int altera_gpio_probe(struct platform_device *pdev)
167 {
168 struct gpio_generic_chip_config config;
169 struct device *dev = &pdev->dev;
170 int reg, ret;
171 struct altera_gpio_chip *altera_gc;
172 struct gpio_generic_chip *chip;
173 struct gpio_chip *gc;
174 struct gpio_irq_chip *girq;
175 int mapped_irq;
176
177 altera_gc = devm_kzalloc(&pdev->dev, sizeof(*altera_gc), GFP_KERNEL);
178 if (!altera_gc)
179 return -ENOMEM;
180
181 raw_spin_lock_init(&altera_gc->gpio_lock);
182
183 altera_gc->regs = devm_platform_ioremap_resource(pdev, 0);
184 if (IS_ERR(altera_gc->regs))
185 return dev_err_probe(dev, PTR_ERR(altera_gc->regs),
186 "failed to ioremap memory resource\n");
187
188 chip = &altera_gc->chip;
189
190 config = (struct gpio_generic_chip_config) {
191 .dev = dev,
192 .sz = 4,
193 .dat = altera_gc->regs + ALTERA_GPIO_DATA,
194 .set = altera_gc->regs + ALTERA_GPIO_DATA,
195 .dirout = altera_gc->regs + ALTERA_GPIO_DIR,
196 };
197
198 ret = gpio_generic_chip_init(chip, &config);
199 if (ret)
200 return dev_err_probe(dev, ret, "unable to init generic GPIO\n");
201
202 gc = &chip->gc;
203
204 if (device_property_read_u32(dev, "altr,ngpio", ®))
205 /* By default assume maximum ngpio */
206 gc->ngpio = ALTERA_GPIO_MAX_NGPIO;
207 else
208 gc->ngpio = reg;
209
210 if (gc->ngpio > ALTERA_GPIO_MAX_NGPIO) {
211 dev_warn(&pdev->dev,
212 "ngpio is greater than %d, defaulting to %d\n",
213 ALTERA_GPIO_MAX_NGPIO, ALTERA_GPIO_MAX_NGPIO);
214 gc->ngpio = ALTERA_GPIO_MAX_NGPIO;
215 }
216
217 gc->base = -1;
218 gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pfw", dev_fwnode(dev));
219 if (!gc->label)
220 return -ENOMEM;
221
222 mapped_irq = platform_get_irq_optional(pdev, 0);
223 if (mapped_irq < 0) {
> 224 if (irq != -ENXIO)
225 return irq;
226 goto skip_irq;
227 }
228
229 if (device_property_read_u32(dev, "altr,interrupt-type", ®)) {
230 dev_err(&pdev->dev,
231 "altr,interrupt-type value not set in device tree\n");
232 return -EINVAL;
233 }
234 altera_gc->interrupt_trigger = reg;
235
236 girq = &gc->irq;
237 gpio_irq_chip_set_chip(girq, &altera_gpio_irq_chip);
238
239 if (altera_gc->interrupt_trigger == IRQ_TYPE_LEVEL_HIGH)
240 girq->parent_handler = altera_gpio_irq_leveL_high_handler;
241 else
242 girq->parent_handler = altera_gpio_irq_edge_handler;
243 girq->num_parents = 1;
244 girq->parents = devm_kcalloc(&pdev->dev, 1, sizeof(*girq->parents),
245 GFP_KERNEL);
246 if (!girq->parents)
247 return -ENOMEM;
248 girq->default_type = IRQ_TYPE_NONE;
249 girq->handler = handle_bad_irq;
250 girq->parents[0] = mapped_irq;
251
252 skip_irq:
253 ret = devm_gpiochip_add_data(dev, gc, altera_gc);
254 if (ret) {
255 dev_err(&pdev->dev, "Failed adding memory mapped gpiochip\n");
256 return ret;
257 }
258
259 return 0;
260 }
261
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-03 7:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 7:34 [brgl:gpio/for-next 5/8] drivers/gpio/gpio-altera.c:224:11: warning: comparison between pointer and integer ('struct gpio_irq_chip *' and 'int') kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox