From: bui duc phuc <[email protected]>

devm_gpiod_get_optional() may return -EPROBE_DEFER or other errors,
but sharp_memory_probe() currently ignores them.

Check the return value and propagate errors from the enable GPIO lookup.

Fixes: b8f9f21716fe ("drm/tiny: Add driver for Sharp Memory LCD")
Signed-off-by: bui duc phuc <[email protected]>
---
 drivers/gpu/drm/tiny/sharp-memory.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/tiny/sharp-memory.c 
b/drivers/gpu/drm/tiny/sharp-memory.c
index 7efd7b567f3b..35254a2136c9 100644
--- a/drivers/gpu/drm/tiny/sharp-memory.c
+++ b/drivers/gpu/drm/tiny/sharp-memory.c
@@ -552,6 +552,9 @@ static int sharp_memory_probe(struct spi_device *spi)
                return dev_err_probe(dev, ret, "Failed to initialize drm 
config\n");
 
        smd->enable_gpio = devm_gpiod_get_optional(dev, "enable", 
GPIOD_OUT_HIGH);
+       if (IS_ERR(smd->enable_gpio))
+               return dev_err_probe(dev, PTR_ERR(smd->enable_gpio),
+                                    "Failed to get enable gpio\n");
        if (!smd->enable_gpio)
                dev_warn(dev, "Enable gpio not defined\n");
 
-- 
2.43.0

Reply via email to