Skip to contentSkip to conversation

media: exynos4-is: Add missed check for pinctrl_lookup_state()

PATCH In review Chuhong Yuan 2 participants 2 messages May 28, 2020 – Aug 10, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 media: exynos4-is: Add missed check for pinctrl_lookup_state()

fimc_md_get_pinctrl() misses a check for pinctrl_lookup_state(). Add the missed check to fix it.

Fixes 4163851f7b99 ("[media] s5p-fimc: Use pinctrl API for camera ports configuration]")

---
Changes in v2:
- Add fixes tag.

 drivers/media/platform/exynos4-is/media-dev.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/platform/exynos4-is/media-dev.c +3 -0
index 9aaf3b8060d5..9c31d950cddf 100644
@@ -1270,6 +1270,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd)
 
 	pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl,
 					PINCTRL_STATE_IDLE);
+	if (IS_ERR(pctl->state_idle))
+		return PTR_ERR(pctl->state_idle);
+
 	return 0;
 }
 
Signature · 1 line
2.26.2
#1 lore raw

Hi,

Quoted 17 lines · Chuhong Yuan

fimc_md_get_pinctrl() misses a check for pinctrl_lookup_state(). Add the missed check to fix it.

Fixes 4163851f7b99 ("[media] s5p-fimc: Use pinctrl API for camera ports configuration]")

---
Changes in v2:
- Add fixes tag.

 drivers/media/platform/exynos4-is/media-dev.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/platform/exynos4-is/media-dev.c +0 -0
index 9aaf3b8060d5..9c31d950cddf 100644

drivers/media/platform/exynos4-is/media-dev.c static int fimc_md_get_pinctrl(struct fimc_md *fmd) · line 1274

Quoted 5 lines
drivers/media/platform/exynos4-is/media-dev.c +2 -0
@@ -1270,6 +1270,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd)
 
 	pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl,
 					PINCTRL_STATE_IDLE);
+	if (IS_ERR(pctl->state_idle))
+		return PTR_ERR(pctl->state_idle);

Unfortunately this is not correct, with that change the driver currently fails to initialize. The "idle" pinctrl state is optional and might not be specified in DT, as explained in the DT binding documentation added by the patch you mentioned in the "Fixes" tag.
Actually the "idle" state is now not used in any mainline dts, I will post a patch that removes related code in the driver.

Signature · 2 lines
Thanks,
Sylwester