@@ -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)
@@ -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)
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to simplify code. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- drivers/gpu/drm/bridge/tc358762.c | 10 ++-------- drivers/gpu/drm/bridge/tc358764.c | 5 +---- 2 files changed, 3 insertions(+), 12 deletions(-)