Message ID | f1157236eacdaab3def9b7d18f1c2e7ef9a3699d.1636672052.git.mchehab+huawei@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix some W=1 clang Werror at staging/media | expand |
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> Reviewed-by: Nathan Chancellor <nathan@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; > } > > -- > 2.33.1 > >
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
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; }
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(+)