[PATCH] mtd: physmap_of_gemini: Fix disabled pinctrl state check

Chen Ni posted 1 patch 1 month, 1 week ago
drivers/mtd/maps/physmap-gemini.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mtd: physmap_of_gemini: Fix disabled pinctrl state check
Posted by Chen Ni 1 month, 1 week ago
The condition for checking the disabled pinctrl state incorrectly checks
gf->enabled_state instead of gf->disabled_state. This causes misleading
error messages and could lead to incorrect behavior when only one of the
pinctrl states is defined.

Fix the condition to properly check gf->disabled_state.

Fixes: 9d3b5086f6d4 ("mtd: physmap_of_gemini: Handle pin control")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/mtd/maps/physmap-gemini.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/maps/physmap-gemini.c b/drivers/mtd/maps/physmap-gemini.c
index 9d3b4bf84a1a..1c34b4ef77ea 100644
--- a/drivers/mtd/maps/physmap-gemini.c
+++ b/drivers/mtd/maps/physmap-gemini.c
@@ -181,7 +181,7 @@ int of_flash_probe_gemini(struct platform_device *pdev,
 		dev_err(dev, "no enabled pin control state\n");
 
 	gf->disabled_state = pinctrl_lookup_state(gf->p, "disabled");
-	if (IS_ERR(gf->enabled_state)) {
+	if (IS_ERR(gf->disabled_state)) {
 		dev_err(dev, "no disabled pin control state\n");
 	} else {
 		ret = pinctrl_select_state(gf->p, gf->disabled_state);
-- 
2.25.1
Re: [PATCH] mtd: physmap_of_gemini: Fix disabled pinctrl state check
Posted by Miquel Raynal 3 weeks, 6 days ago
On Fri, 27 Feb 2026 09:43:36 +0800, Chen Ni wrote:
> The condition for checking the disabled pinctrl state incorrectly checks
> gf->enabled_state instead of gf->disabled_state. This causes misleading
> error messages and could lead to incorrect behavior when only one of the
> pinctrl states is defined.
> 
> Fix the condition to properly check gf->disabled_state.
> 
> [...]

Applied to mtd/next, thanks!

[1/1] mtd: physmap_of_gemini: Fix disabled pinctrl state check
      commit: b7c0982184b0661f5b1b805f3a56f1bd3757b63e

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl

Re: [PATCH] mtd: physmap_of_gemini: Fix disabled pinctrl state check
Posted by Linus Walleij 1 month, 1 week ago
On Fri, Feb 27, 2026 at 2:44 AM Chen Ni <nichen@iscas.ac.cn> wrote:

> The condition for checking the disabled pinctrl state incorrectly checks
> gf->enabled_state instead of gf->disabled_state. This causes misleading
> error messages and could lead to incorrect behavior when only one of the
> pinctrl states is defined.
>
> Fix the condition to properly check gf->disabled_state.
>
> Fixes: 9d3b5086f6d4 ("mtd: physmap_of_gemini: Handle pin control")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>

Ooops! Thanks for finding this Chen!
Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij