* [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors
@ 2026-10-09 11:26 phucduc.bui
2026-10-10 1:25 ` kernel test robot
0 siblings, 1 reply; 3+ messages in thread
From: phucduc.bui @ 2026-10-09 11:26 UTC (permalink / raw)
To: Linus Walleij
Cc: Darian Biastoch, Andreas Kaessens, linux-gpio, linux-kernel,
bui duc phuc
From: bui duc phuc <phucduc.bui@gmail.com>
devm_gpiod_get_optional() may return -EPROBE_DEFER or other errors,
but mcp23s08_probe_one() currently ignores them.
Check the return value and propagate errors from the reset GPIO lookup.
Fixes: 4e73bfa3ee37 ("pinctrl: mcp23s08: Add optional reset GPIO")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
drivers/pinctrl/pinctrl-mcp23s08.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c
index cc668f84bf8b..fab6d19a559e 100644
--- a/drivers/pinctrl/pinctrl-mcp23s08.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08.c
@@ -613,6 +613,8 @@ int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
mcp->chip.owner = THIS_MODULE;
mcp->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(mcp->reset_gpio))
+ return dev_err_probe(dev, ret, "failed to get reset GPIO\n");
/* verify MCP_IOCON.SEQOP = 0, so sequential reads work,
* and MCP_IOCON.HAEN = 1, so we work with all chips.
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors
2026-10-09 11:26 [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors phucduc.bui
@ 2026-10-10 1:25 ` kernel test robot
2026-10-10 3:26 ` Bui Duc Phuc
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-10-10 1:25 UTC (permalink / raw)
To: phucduc.bui, Linus Walleij
Cc: llvm, oe-kbuild-all, Darian Biastoch, Andreas Kaessens,
linux-gpio, linux-kernel, bui duc phuc
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linusw-pinctrl/for-next]
[also build test WARNING on linus/master v7.3-rc6 next-20261008]
[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/phucduc-bui-gmail-com/pinctrl-mcp23s08-Propagate-reset-GPIO-errors/20261009-182634
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git for-next
patch link: https://lore.kernel.org/r/20261009112634.33436-1-phucduc.bui%40gmail.com
patch subject: [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors
config: powerpc64-randconfig-1000-20261010 (https://download.01.org/0day-ci/archive/20261010/202610100943.RQhhOoh8-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 242243a5814307de825db3428662d67b064e2cbc)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261010/202610100943.RQhhOoh8-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/202610100943.RQhhOoh8-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/pinctrl/pinctrl-mcp23s08.c:617:29: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
617 | return dev_err_probe(dev, ret, "failed to get reset GPIO\n");
| ^~~
drivers/pinctrl/pinctrl-mcp23s08.c:592:17: note: initialize the variable 'ret' to silence this warning
592 | int status, ret;
| ^
| = 0
1 warning generated.
vim +/ret +617 drivers/pinctrl/pinctrl-mcp23s08.c
588
589 int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
590 unsigned int addr, unsigned int type, unsigned int base)
591 {
592 int status, ret;
593 bool mirror = false;
594 bool open_drain = false;
595
596 mutex_init(&mcp->lock);
597
598 mcp->dev = dev;
599 mcp->addr = addr;
600
601 mcp->irq_active_high = false;
602
603 mcp->chip.direction_input = mcp23s08_direction_input;
604 mcp->chip.get = mcp23s08_get;
605 mcp->chip.get_multiple = mcp23s08_get_multiple;
606 mcp->chip.direction_output = mcp23s08_direction_output;
607 mcp->chip.set = mcp23s08_set;
608 mcp->chip.set_multiple = mcp23s08_set_multiple;
609
610 mcp->chip.base = base;
611 mcp->chip.can_sleep = true;
612 mcp->chip.parent = dev;
613 mcp->chip.owner = THIS_MODULE;
614
615 mcp->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
616 if (IS_ERR(mcp->reset_gpio))
> 617 return dev_err_probe(dev, ret, "failed to get reset GPIO\n");
618
619 /* verify MCP_IOCON.SEQOP = 0, so sequential reads work,
620 * and MCP_IOCON.HAEN = 1, so we work with all chips.
621 */
622
623 ret = mcp_read(mcp, MCP_IOCON, &status);
624 if (ret < 0)
625 return dev_err_probe(dev, ret, "can't identify chip %d\n", addr);
626
627 mcp->irq_controller =
628 device_property_read_bool(dev, "interrupt-controller");
629 if (mcp->irq && mcp->irq_controller) {
630 mcp->irq_active_high =
631 device_property_read_bool(dev,
632 "microchip,irq-active-high");
633
634 mirror = device_property_read_bool(dev, "microchip,irq-mirror");
635 open_drain = device_property_read_bool(dev, "drive-open-drain");
636 }
637
638 if ((status & IOCON_SEQOP) || !(status & IOCON_HAEN) || mirror ||
639 mcp->irq_active_high || open_drain) {
640 /* mcp23s17 has IOCON twice, make sure they are in sync */
641 status &= ~(IOCON_SEQOP | (IOCON_SEQOP << 8));
642 status |= IOCON_HAEN | (IOCON_HAEN << 8);
643 if (mcp->irq_active_high)
644 status |= IOCON_INTPOL | (IOCON_INTPOL << 8);
645 else
646 status &= ~(IOCON_INTPOL | (IOCON_INTPOL << 8));
647
648 if (mirror)
649 status |= IOCON_MIRROR | (IOCON_MIRROR << 8);
650
651 if (open_drain)
652 status |= IOCON_ODR | (IOCON_ODR << 8);
653
654 if (type == MCP_TYPE_S18 || type == MCP_TYPE_018)
655 status |= IOCON_INTCC | (IOCON_INTCC << 8);
656
657 ret = mcp_write(mcp, MCP_IOCON, status);
658 if (ret < 0)
659 return dev_err_probe(dev, ret, "can't write IOCON %d\n", addr);
660 }
661
662 if (mcp->irq && mcp->irq_controller) {
663 struct gpio_irq_chip *girq = &mcp->chip.irq;
664
665 /*
666 * Disable all pin interrupts, to prevent the interrupt handler from
667 * calling nested handlers for any currently-enabled interrupts that
668 * do not (yet) have an actual handler.
669 */
670 ret = mcp_write(mcp, MCP_GPINTEN, 0);
671 if (ret < 0)
672 return dev_err_probe(dev, ret, "can't disable interrupts\n");
673
674 gpio_irq_chip_set_chip(girq, &mcp23s08_irq_chip);
675 /* This will let us handle the parent IRQ in the driver */
676 girq->parent_handler = NULL;
677 girq->num_parents = 0;
678 girq->parents = NULL;
679 girq->default_type = IRQ_TYPE_NONE;
680 girq->handler = handle_simple_irq;
681 girq->threaded = true;
682 }
683
684 ret = devm_gpiochip_add_data(dev, &mcp->chip, mcp);
685 if (ret < 0)
686 return dev_err_probe(dev, ret, "can't add GPIO chip\n");
687
688 mcp->pinctrl_desc.pctlops = &mcp_pinctrl_ops;
689 mcp->pinctrl_desc.confops = &mcp_pinconf_ops;
690 mcp->pinctrl_desc.npins = mcp->chip.ngpio;
691 if (mcp->pinctrl_desc.npins == 8)
692 mcp->pinctrl_desc.pins = mcp23x08_pins;
693 else if (mcp->pinctrl_desc.npins == 16)
694 mcp->pinctrl_desc.pins = mcp23x17_pins;
695 mcp->pinctrl_desc.owner = THIS_MODULE;
696
697 mcp->pctldev = devm_pinctrl_register(dev, &mcp->pinctrl_desc, mcp);
698 if (IS_ERR(mcp->pctldev))
699 return dev_err_probe(dev, PTR_ERR(mcp->pctldev), "can't register controller\n");
700
701 if (mcp->irq) {
702 ret = mcp23s08_irq_setup(mcp);
703 if (ret)
704 return dev_err_probe(dev, ret, "can't setup IRQ\n");
705 }
706
707 return 0;
708 }
709 EXPORT_SYMBOL_GPL(mcp23s08_probe_one);
710
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors
2026-10-10 1:25 ` kernel test robot
@ 2026-10-10 3:26 ` Bui Duc Phuc
0 siblings, 0 replies; 3+ messages in thread
From: Bui Duc Phuc @ 2026-10-10 3:26 UTC (permalink / raw)
To: kernel test robot
Cc: Linus Walleij, llvm, oe-kbuild-all, Darian Biastoch,
Andreas Kaessens, linux-gpio, linux-kernel
> 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/202610100943.RQhhOoh8-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/pinctrl/pinctrl-mcp23s08.c:617:29: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
> 617 | return dev_err_probe(dev, ret, "failed to get reset GPIO\n");
> | ^~~
> drivers/pinctrl/pinctrl-mcp23s08.c:592:17: note: initialize the variable 'ret' to silence this warning
> 592 | int status, ret;
> | ^
> | = 0
> 1 warning generated.
>
Thanks for the report.
I also received a similar warning from the sashiko-reviews earlier.
I'll return PTR_ERR(mcp->reset_gpio) in v2.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-10 3:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 11:26 [PATCH] pinctrl: mcp23s08: Propagate reset GPIO errors phucduc.bui
2026-10-10 1:25 ` kernel test robot
2026-10-10 3:26 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®