Skip to contentSkip to conversation

drm/tegra: Fix gpiod_get_from_of_node() regression

PATCH In review Dmitry Osipenko 2 participants 3 messages Jul 5, 2019 – Jul 9, 2019

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

PATCH 1/1 drm/tegra: Fix gpiod_get_from_of_node() regression

That function now returns ERR_PTR instead of NULL if "hpd-gpio" is not present in device-tree. The offending patch missed to adapt the Tegra's DRM driver for the API change.

Fixes 025bf37725f1 ("gpio: Fix return value mismatch of function gpiod_get_from_of_node()")
---
 drivers/gpu/drm/tegra/output.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/output.c +6 -2
index 274cb955e2e1..471d33809cd4 100644
@@ -126,8 +126,12 @@ int tegra_output_probe(struct tegra_output *output)
 						       "nvidia,hpd-gpio", 0,
 						       GPIOD_IN,
 						       "HDMI hotplug detect");
-	if (IS_ERR(output->hpd_gpio))
-		return PTR_ERR(output->hpd_gpio);
+	if (IS_ERR(output->hpd_gpio)) {
+		if (PTR_ERR(output->hpd_gpio) == -ENOENT)
+			output->hpd_gpio = NULL;
+		else
+			return PTR_ERR(output->hpd_gpio);
+	}
 
 	if (output->hpd_gpio) {
 		err = gpiod_to_irq(output->hpd_gpio);
Signature · 1 line
2.22.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Dmitry Osipenko

That function now returns ERR_PTR instead of NULL if "hpd-gpio" is not present in device-tree. The offending patch missed to adapt the Tegra's DRM driver for the API change.

Fixes 025bf37725f1 ("gpio: Fix return value mismatch of function gpiod_get_from_of_node()")
---
 drivers/gpu/drm/tegra/output.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/output.c +0 -1
index 274cb955e2e1..471d33809cd4 100644
@@ -126,8 +126,12 @@ int tegra_output_probe(struct tegra_output *output)
 						       "nvidia,hpd-gpio", 0,
 						       GPIOD_IN,
 						       "HDMI hotplug detect");
-	if (IS_ERR(output->hpd_gpio))

drivers/gpu/drm/tegra/output.c int tegra_output_probe(struct tegra_output *output) · line 137

Quoted 10 lines
drivers/gpu/drm/tegra/output.c +6 -1
-		return PTR_ERR(output->hpd_gpio);
+	if (IS_ERR(output->hpd_gpio)) {
+		if (PTR_ERR(output->hpd_gpio) == -ENOENT)
+			output->hpd_gpio = NULL;
+		else
+			return PTR_ERR(output->hpd_gpio);
+	}
 
 	if (output->hpd_gpio) {
 		err = gpiod_to_irq(output->hpd_gpio);

Cheers
Jon

Signature · 1 line
nvpublic
#2 lore raw

09.07.2019 19:27, Jon Hunter пишет:

Quoted 29 lines · Dmitry Osipenko
Quoted 27 lines

That function now returns ERR_PTR instead of NULL if "hpd-gpio" is not present in device-tree. The offending patch missed to adapt the Tegra's DRM driver for the API change.

Fixes 025bf37725f1 ("gpio: Fix return value mismatch of function gpiod_get_from_of_node()")
---
 drivers/gpu/drm/tegra/output.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/tegra/output.c +6 -2
index 274cb955e2e1..471d33809cd4 100644
@@ -126,8 +126,12 @@ int tegra_output_probe(struct tegra_output *output)
 						       "nvidia,hpd-gpio", 0,
 						       GPIOD_IN,
 						       "HDMI hotplug detect");
-	if (IS_ERR(output->hpd_gpio))
-		return PTR_ERR(output->hpd_gpio);
+	if (IS_ERR(output->hpd_gpio)) {
+		if (PTR_ERR(output->hpd_gpio) == -ENOENT)
+			output->hpd_gpio = NULL;
+		else
+			return PTR_ERR(output->hpd_gpio);
+	}
 
Quoted 5 lines

drivers/gpu/drm/tegra/output.c int tegra_output_probe(struct tegra_output *output) · line 137

Quoted 3 lines
drivers/gpu/drm/tegra/output.c +0 -0
 	if (output->hpd_gpio) {
 		err = gpiod_to_irq(output->hpd_gpio);

Thanks!