Message ID | 20210415005106.530914-9-vrzh@vrzh.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | staging: media: atomisp: [1/2] Remove redundant assertions in sh_css.c | expand |
On 15/04/2021 02:51, Martiros Shakhzadyan wrote: > Remove assert() in places where the condition is already handled. > > Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net> > --- > drivers/staging/media/atomisp/pci/sh_css.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c > index 4e3ef68014ec..aebecf650967 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css.c > +++ b/drivers/staging/media/atomisp/pci/sh_css.c > @@ -413,7 +413,6 @@ aspect_ratio_crop(struct ia_css_pipe *curr_pipe, > static void > sh_css_pipe_free_shading_table(struct ia_css_pipe *pipe) > { > - assert(pipe); > if (!pipe) { > IA_CSS_ERROR("NULL input parameter"); > return; > @@ -1080,7 +1079,6 @@ sh_css_config_input_network(struct ia_css_stream *stream) > } > } > > - assert(pipe); > if (!pipe) > return -EINVAL; > > @@ -1382,10 +1380,11 @@ start_copy_on_sp(struct ia_css_pipe *pipe, > struct ia_css_frame *out_frame) > { > (void)out_frame; > - assert(pipe); > - assert(pipe->stream); > > - if ((!pipe) || (!pipe->stream)) > + if (!pipe) > + return -EINVAL; > + > + if (!pipe->stream) > return -EINVAL; Why was this 'if' rewritten? What was wrong with the original? Also, this change has nothing to do with the removal of assert(), so that makes me suspect that this change wasn't intended by you. Regards, Hans > > #if !defined(ISP2401) >
diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 4e3ef68014ec..aebecf650967 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -413,7 +413,6 @@ aspect_ratio_crop(struct ia_css_pipe *curr_pipe, static void sh_css_pipe_free_shading_table(struct ia_css_pipe *pipe) { - assert(pipe); if (!pipe) { IA_CSS_ERROR("NULL input parameter"); return; @@ -1080,7 +1079,6 @@ sh_css_config_input_network(struct ia_css_stream *stream) } } - assert(pipe); if (!pipe) return -EINVAL; @@ -1382,10 +1380,11 @@ start_copy_on_sp(struct ia_css_pipe *pipe, struct ia_css_frame *out_frame) { (void)out_frame; - assert(pipe); - assert(pipe->stream); - if ((!pipe) || (!pipe->stream)) + if (!pipe) + return -EINVAL; + + if (!pipe->stream) return -EINVAL; #if !defined(ISP2401)
Remove assert() in places where the condition is already handled. Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net> --- drivers/staging/media/atomisp/pci/sh_css.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)