Re: [PATCH] gpio: mpc8xxx: Add ACPI support

From: kernel test robot
Date: Fri Mar 12 2021 - 20:06:13 EST


Hi Ran,

I love your patch! Perhaps something to improve:

[auto build test WARNING on gpio/for-next]
[also build test WARNING on v5.12-rc2 next-20210312]
[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/Ran-Wang/gpio-mpc8xxx-Add-ACPI-support/20210312-145412
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: arm-randconfig-m031-20210312 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/gpio/gpio-mpc8xxx.c:356 mpc8xxx_probe() error: uninitialized symbol 'devtype'.

vim +/devtype +356 drivers/gpio/gpio-mpc8xxx.c

e39d5ef678045d arch/powerpc/sysdev/mpc8xxx_gpio.c Anatolij Gustschin 2010-08-09 299
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 300 static int mpc8xxx_probe(struct platform_device *pdev)
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 301 {
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 302 struct device_node *np = pdev->dev.of_node;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 303 struct mpc8xxx_gpio_chip *mpc8xxx_gc;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 304 struct gpio_chip *gc;
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 305 const struct mpc8xxx_gpio_devtype *devtype;
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 306 const struct acpi_device_id *acpi_id;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 307 int ret;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 308
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 309 if (pdev->dev.of_node) {
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 310 devtype = of_device_get_match_data(&pdev->dev);
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 311 } else {
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 312 acpi_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 313 &pdev->dev);
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 314 if (acpi_id)
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 315 devtype = (struct mpc8xxx_gpio_devtype *) acpi_id->driver_data;
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 316 }
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 317
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 318 mpc8xxx_gc = devm_kzalloc(&pdev->dev, sizeof(*mpc8xxx_gc), GFP_KERNEL);
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 319 if (!mpc8xxx_gc)
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 320 return -ENOMEM;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 321
257e10752c13f2 drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 322 platform_set_drvdata(pdev, mpc8xxx_gc);
257e10752c13f2 drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 323
505936131ea71e drivers/gpio/gpio-mpc8xxx.c Alexander Stein 2015-07-21 324 raw_spin_lock_init(&mpc8xxx_gc->lock);
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 325
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 326 mpc8xxx_gc->regs = devm_platform_ioremap_resource(pdev, 0);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 327 if (!mpc8xxx_gc->regs)
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 328 return -ENOMEM;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 329
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 330 gc = &mpc8xxx_gc->gc;
322f6a3182d42d drivers/gpio/gpio-mpc8xxx.c Johnson CH Chen (陳昭勳 2019-11-26 331) gc->parent = &pdev->dev;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 332
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 333 if (device_property_read_bool(&pdev->dev, "little-endian")) {
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 334 ret = bgpio_init(gc, &pdev->dev, 4,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 335 mpc8xxx_gc->regs + GPIO_DAT,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 336 NULL, NULL,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 337 mpc8xxx_gc->regs + GPIO_DIR, NULL,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 338 BGPIOF_BIG_ENDIAN);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 339 if (ret)
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 340 goto err;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 341 dev_dbg(&pdev->dev, "GPIO registers are LITTLE endian\n");
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 342 } else {
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 343 ret = bgpio_init(gc, &pdev->dev, 4,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 344 mpc8xxx_gc->regs + GPIO_DAT,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 345 NULL, NULL,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 346 mpc8xxx_gc->regs + GPIO_DIR, NULL,
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 347 BGPIOF_BIG_ENDIAN
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 348 | BGPIOF_BIG_ENDIAN_BYTE_ORDER);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 349 if (ret)
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 350 goto err;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 351 dev_dbg(&pdev->dev, "GPIO registers are BIG endian\n");
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 352 }
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 353
fa4007ca06e4c8 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 354 mpc8xxx_gc->direction_output = gc->direction_output;
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 355
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 @356 if (!devtype)
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 357 devtype = &mpc8xxx_gpio_devtype_default;
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 358
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 359 /*
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 360 * It's assumed that only a single type of gpio controller is available
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 361 * on the current machine, so overwriting global data is fine.
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 362 */
4e50573f39229d drivers/gpio/gpio-mpc8xxx.c Vladimir Oltean 2019-11-15 363 if (devtype->irq_set_type)
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 364 mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type;
82e39b0d8566fa drivers/gpio/gpio-mpc8xxx.c Uwe Kleine-König 2015-07-16 365
adf32eaa053234 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 366 if (devtype->gpio_dir_out)
adf32eaa053234 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 367 gc->direction_output = devtype->gpio_dir_out;
adf32eaa053234 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 368 if (devtype->gpio_get)
adf32eaa053234 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 369 gc->get = devtype->gpio_get;
adf32eaa053234 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 370
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 371 gc->to_irq = mpc8xxx_gpio_to_irq;
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 372
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 373 /*
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 374 * The GPIO Input Buffer Enable register(GPIO_IBE) is used to control
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 375 * the input enable of each individual GPIO port. When an individual
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 376 * GPIO port’s direction is set to input (GPIO_GPDIR[DRn=0]), the
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 377 * associated input enable must be set (GPIOxGPIE[IEn]=1) to propagate
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 378 * the port value to the GPIO Data Register.
3795d7cc4fe132 drivers/gpio/gpio-mpc8xxx.c Michael Walle 2020-09-30 379 */
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 380 if (pdev->dev.of_node) {
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 381 if (of_device_is_compatible(np, "fsl,qoriq-gpio"))
787b64a43f7aca drivers/gpio/gpio-mpc8xxx.c Russell King 2019-11-19 382 gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 383 } else {
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 384 if (acpi_match_device(pdev->dev.driver->acpi_match_table,
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 385 &pdev->dev))
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 386 gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff);
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 387 }
787b64a43f7aca drivers/gpio/gpio-mpc8xxx.c Russell King 2019-11-19 388
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 389 ret = gpiochip_add_data(gc, mpc8xxx_gc);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 390 if (ret) {
7eb6ce2f272336 drivers/gpio/gpio-mpc8xxx.c Rob Herring 2017-07-18 391 pr_err("%pOF: GPIO chip registration failed with status %d\n",
7eb6ce2f272336 drivers/gpio/gpio-mpc8xxx.c Rob Herring 2017-07-18 392 np, ret);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 393 goto err;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 394 }
1e16dfc1baa745 arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2008-09-23 395
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 396 mpc8xxx_gc->irqn = platform_get_irq(pdev, 0);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 397 if (!mpc8xxx_gc->irqn)
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 398 return 0;
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 399
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 400 mpc8xxx_gc->irq = irq_domain_create_linear(dev_fwnode(&pdev->dev),
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 401 MPC8XXX_GPIO_PINS,
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 402 &mpc8xxx_gpio_irq_ops,
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 403 mpc8xxx_gc);
f6481b7d46fa21 drivers/gpio/gpio-mpc8xxx.c Ran Wang 2021-03-12 404
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 405 if (!mpc8xxx_gc->irq)
98686d9a52eeea drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 406 return 0;
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 407
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 408 /* ack and mask all irqs */
cd0d3f58a0ca05 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 409 gc->write_reg(mpc8xxx_gc->regs + GPIO_IER, 0xffffffff);
cd0d3f58a0ca05 drivers/gpio/gpio-mpc8xxx.c Axel Lin 2016-02-22 410 gc->write_reg(mpc8xxx_gc->regs + GPIO_IMR, 0);
345e5c8a1cc30e arch/powerpc/sysdev/mpc8xxx_gpio.c Peter Korsgaard 2010-01-07 411
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 412 ret = devm_request_irq(&pdev->dev, mpc8xxx_gc->irqn,
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 413 mpc8xxx_gpio_irq_cascade,
3d5bfbd9716318 drivers/gpio/gpio-mpc8xxx.c Song Hui 2020-06-11 414 IRQF_SHARED, "gpio-cascade",
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 415 mpc8xxx_gc);
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 416 if (ret) {
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 417 dev_err(&pdev->dev, "%s: failed to devm_request_irq(%d), ret = %d\n",
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 418 np->full_name, mpc8xxx_gc->irqn, ret);
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 419 goto err;
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 420 }
698b8eeaed7287 drivers/gpio/gpio-mpc8xxx.c Song Hui 2019-10-11 421
257e10752c13f2 drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 422 return 0;
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 423 err:
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 424 iounmap(mpc8xxx_gc->regs);
42178e2a1e42b4 drivers/gpio/gpio-mpc8xxx.c Liu Gang 2016-02-03 425 return ret;
257e10752c13f2 drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 426 }
257e10752c13f2 drivers/gpio/gpio-mpc8xxx.c Ricardo Ribalda 2015-01-18 427

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

Attachment: .config.gz
Description: application/gzip