[PATCH -next 1/2] drm/bridge: Use PTR_ERR_OR_ZERO() to simplify code
Jinjie Ruan
ruanjinjie at huawei.com
Tue Aug 22 07:15:02 UTC 2023
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.
Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
---
drivers/gpu/drm/bridge/tc358762.c | 10 ++--------
drivers/gpu/drm/bridge/tc358764.c | 5 +----
2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/bridge/tc358762.c b/drivers/gpu/drm/bridge/tc358762.c
index 46198af9eebb..49fd60a08c1c 100644
--- a/drivers/gpu/drm/bridge/tc358762.c
+++ b/drivers/gpu/drm/bridge/tc358762.c
@@ -240,19 +240,13 @@ static int tc358762_parse_dt(struct tc358762 *ctx)
/* Reset GPIO is optional */
ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
- if (IS_ERR(ctx->reset_gpio))
- return PTR_ERR(ctx->reset_gpio);
-
- return 0;
+ return PTR_ERR_OR_ZERO(ctx->reset_gpio);
}
static int tc358762_configure_regulators(struct tc358762 *ctx)
{
ctx->regulator = devm_regulator_get(ctx->dev, "vddc");
- if (IS_ERR(ctx->regulator))
- return PTR_ERR(ctx->regulator);
-
- return 0;
+ return PTR_ERR_OR_ZERO(ctx->regulator);
}
static int tc358762_probe(struct mipi_dsi_device *dsi)
diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c
index deccb3995022..738ea6e11712 100644
--- a/drivers/gpu/drm/bridge/tc358764.c
+++ b/drivers/gpu/drm/bridge/tc358764.c
@@ -319,10 +319,7 @@ static int tc358764_parse_dt(struct tc358764 *ctx)
}
ctx->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
- if (IS_ERR(ctx->next_bridge))
- return PTR_ERR(ctx->next_bridge);
-
- return 0;
+ return PTR_ERR_OR_ZERO(ctx->next_bridge);
}
static int tc358764_configure_regulators(struct tc358764 *ctx)
--
2.34.1
More information about the dri-devel
mailing list