diff mbox series

[-next] drm: bridge: fix wrong pointer passed to PTR_ERR()

Message ID 20210514070306.606-1-linqiheng@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] drm: bridge: fix wrong pointer passed to PTR_ERR() | expand

Commit Message

Qiheng Lin May 14, 2021, 7:03 a.m. UTC
PTR_ERR should access the value just tested by IS_ERR, otherwise
the wrong error code will be returned.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/gpu/drm/bridge/ite-it66121.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Robert Foss May 17, 2021, 9:01 a.m. UTC | #1
Hey Qiheng,

Thanks for submitting this bugfix.

The title of this patch should probably be:
drm: bridge: it66121: fix wrong pointer passed to PTR_ERR()

With this fixed, feel free to add my r-b.
Reviewed-by: Robert Foss <robert.foss@linaro.org>


On Fri, 14 May 2021 at 09:03, Qiheng Lin <linqiheng@huawei.com> wrote:
>
> PTR_ERR should access the value just tested by IS_ERR, otherwise
> the wrong error code will be returned.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>  drivers/gpu/drm/bridge/ite-it66121.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
> index d8a60691fd32..6980c9801d0d 100644
> --- a/drivers/gpu/drm/bridge/ite-it66121.c
> +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> @@ -943,7 +943,7 @@ static int it66121_probe(struct i2c_client *client,
>         ctx->regmap = devm_regmap_init_i2c(client, &it66121_regmap_config);
>         if (IS_ERR(ctx->regmap)) {
>                 ite66121_power_off(ctx);
> -               return PTR_ERR(ctx);
> +               return PTR_ERR(ctx->regmap);
>         }
>
>         regmap_read(ctx->regmap, IT66121_VENDOR_ID0_REG, &vendor_ids[0]);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index d8a60691fd32..6980c9801d0d 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -943,7 +943,7 @@  static int it66121_probe(struct i2c_client *client,
 	ctx->regmap = devm_regmap_init_i2c(client, &it66121_regmap_config);
 	if (IS_ERR(ctx->regmap)) {
 		ite66121_power_off(ctx);
-		return PTR_ERR(ctx);
+		return PTR_ERR(ctx->regmap);
 	}
 
 	regmap_read(ctx->regmap, IT66121_VENDOR_ID0_REG, &vendor_ids[0]);