Re: [PATCH 3/3] media: atomisp: handle errors at sh_css_create_isp_params()

Dan Carpenter
2021-11-15T09:52:31Z

On Thu, Nov 11, 2021 at 11:08:53PM +0000, Mauro Carvalho Chehab wrote:
> The succ var tracks memory allocation erros on this function.
>
> Fix it, in order to stop this W=1 Werror in clang:
>
> drivers/staging/media/atomisp/pci/sh_css_params.c:2430:7: error: variable 'succ' set but not used [-Werror,-Wunused-but-set-variable]
> bool succ = true;
> ^
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
>
> To mailbombing on a large number of people, only mailing lists were C/C on the cover.
> See [PATCH 0/3] at: https://lore.kernel.org/all/cover.1636672052.git.mchehab+huawei@kernel.org/
>
> drivers/staging/media/atomisp/pci/sh_css_params.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
> index dbd3bfe3d343..3cc5b82a8a31 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_params.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
> @@ -2473,6 +2473,10 @@ sh_css_create_isp_params(struct ia_css_stream *stream,
> succ &= (ddr_ptrs->macc_tbl != mmgr_NULL);
>
> *isp_params_out = params;
> +
> + if (!succ)
> + return -ENOMEM;
> +
> return err;

Better to "return 0;"

regards,
dan carpenter