Re: [PATCH] vcodec: mediatek: fix odd_ptr_err.cocci warnings

From: Tiffany Lin
Date: Wed Sep 07 2016 - 01:25:37 EST


On Tue, 2016-09-06 at 22:51 +0800, Julia Lawall wrote:
> PTR_ERR should access the value just tested by IS_ERR
>
> Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
>
> CC: Tiffany Lin <tiffany.lin@xxxxxxxxxxxx>
> Signed-off-by: Julia Lawall <julia.lawall@xxxxxxx>
> Signed-off-by: Fengguang Wu <fengguang.wu@xxxxxxxxx>

Reviewed-by:Tiffany Lin <tiffany.lin@xxxxxxxxxxxx>

> ---
>
> mtk_vcodec_dec_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> @@ -255,7 +255,7 @@ static int mtk_vcodec_probe(struct platf
> }
> dev->reg_base[i] = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR((__force void *)dev->reg_base[i])) {
> - ret = PTR_ERR((__force void *)dev->reg_base);
> + ret = PTR_ERR((__force void *)dev->reg_base[i]);
> goto err_res;
> }
> mtk_v4l2_debug(2, "reg[%d] base=%p", i, dev->reg_base[i]);