media: atomisp: remove redundant assignments to variables
Subsystems (5)
Media (V4L/DVB) Staging Kernel janitors Intel MID (Mobile Internet Device) platform +1 more subsystems
PATCH 1/1 media: atomisp: remove redundant assignments to variables
There are several variables that are being initialized with values that are never read, the assignment are redundant and can be removed. Cleans up cppcheck unreadVariable warnings.
Signed-off-by Colin Ian King <[email protected]>
--- .../atomisp/pci/base/circbuf/src/circbuf.c | 2 +- .../pci/runtime/pipeline/src/pipeline.c | 4 +--- .../atomisp/pci/runtime/queue/src/queue.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-)
drivers/staging/media/atomisp/pci/base/circbuf/src/circbuf.c +1 -1
@@ -207,7 +207,7 @@ bool ia_css_circbuf_increase_size( {u8 curr_size;u8 curr_end; -unsigned int i =0 ; +unsigned int i;if (!cb || sz_delta ==0 )return false;
drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +1 -1
@@ -693,7 +691,7 @@ static void pipeline_init_defaults(static void ia_css_pipeline_set_zoom_stage (struct ia_css_pipeline *pipeline) {struct ia_css_pipeline_stage *stage =NULL ; -int err =0 ; +int err;assert (pipeline);if (pipeline->pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) {
drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c +9 -9
@@ -81,7 +81,7 @@ int ia_css_queue_uninit(ia_css_queue_t *qhandle)int ia_css_queue_enqueue (ia_css_queue_t *qhandle,uint32_t item) { -int error =0 ; +int error;if (!qhandle)return -EINVAL ;
@@ -138,7 +138,7 @@ int ia_css_queue_enqueue(ia_css_queue_t *qhandle, uint32_t item)int ia_css_queue_dequeue (ia_css_queue_t *qhandle,uint32_t *item) { -int error =0 ; +int error;if (!qhandle ||NULL == item)return -EINVAL ;
@@ -193,7 +193,7 @@ int ia_css_queue_dequeue(ia_css_queue_t *qhandle, uint32_t *item)int ia_css_queue_is_full (ia_css_queue_t *qhandle,bool *is_full) { -int error =0 ; +int error;if ((!qhandle) || (!is_full))return -EINVAL ;
@@ -225,7 +225,7 @@ int ia_css_queue_is_full(ia_css_queue_t *qhandle, bool *is_full)int ia_css_queue_get_free_space (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;
@@ -257,7 +257,7 @@ int ia_css_queue_get_free_space(ia_css_queue_t *qhandle, uint32_t *size)int ia_css_queue_get_used_space (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;
@@ -289,8 +289,8 @@ int ia_css_queue_get_used_space(ia_css_queue_t *qhandle, uint32_t *size)int ia_css_queue_peek (ia_css_queue_t *qhandle,u32 offset,uint32_t *element) { -u32 num_elems =0 ; -int error =0 ; +u32 num_elems; +int error;if ((!qhandle) || (!element))return -EINVAL ;
@@ -338,7 +338,7 @@ int ia_css_queue_peek(ia_css_queue_t *qhandle, u32 offset, uint32_t *element)int ia_css_queue_is_empty (ia_css_queue_t *qhandle,bool *is_empty) { -int error =0 ; +int error;if ((!qhandle) || (!is_empty))return -EINVAL ;
@@ -370,7 +370,7 @@ int ia_css_queue_is_empty(ia_css_queue_t *qhandle, bool *is_empty)int ia_css_queue_get_size (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;
Signature · 1 line
2.39.2
Hi,
Quoted 5 lines · Colin Ian King
There are several variables that are being initialized with values that are never read, the assignment are redundant and can be removed. Cleans up cppcheck unreadVariable warnings.
Signed-off-by Colin Ian King <[email protected]>
Thank you for your patch.
I have merged this in my media-atomisp branch:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomisp
And this patch will be included in my next pull-request to Mauro (to media subsystem maintainer)
Regards,
Hans
Quoted 110 lines
--- .../atomisp/pci/base/circbuf/src/circbuf.c | 2 +- .../pci/runtime/pipeline/src/pipeline.c | 4 +--- .../atomisp/pci/runtime/queue/src/queue.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-)drivers/staging/media/atomisp/pci/base/circbuf/src/circbuf.c +1
-1@@ -207,7 +207,7 @@ bool ia_css_circbuf_increase_size( {u8 curr_size;u8 curr_end; -unsigned int i =0 ; +unsigned int i;if (!cb || sz_delta ==0 )return false;drivers/staging/media/atomisp/pci/runtime/pipeline/src/pipeline.c +1
-1@@ -693,7 +691,7 @@ static void pipeline_init_defaults(static void ia_css_pipeline_set_zoom_stage (struct ia_css_pipeline *pipeline) {struct ia_css_pipeline_stage *stage =NULL ; -int err =0 ; +int err;assert (pipeline);if (pipeline->pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) {drivers/staging/media/atomisp/pci/runtime/queue/src/queue.c +9
-9@@ -81,7 +81,7 @@ int ia_css_queue_uninit(ia_css_queue_t *qhandle)int ia_css_queue_enqueue (ia_css_queue_t *qhandle,uint32_t item) { -int error =0 ; +int error;if (!qhandle)return -EINVAL ;@@ -138,7 +138,7 @@ int ia_css_queue_enqueue(ia_css_queue_t *qhandle, uint32_t item)int ia_css_queue_dequeue (ia_css_queue_t *qhandle,uint32_t *item) { -int error =0 ; +int error;if (!qhandle ||NULL == item)return -EINVAL ;@@ -193,7 +193,7 @@ int ia_css_queue_dequeue(ia_css_queue_t *qhandle, uint32_t *item)int ia_css_queue_is_full (ia_css_queue_t *qhandle,bool *is_full) { -int error =0 ; +int error;if ((!qhandle) || (!is_full))return -EINVAL ;@@ -225,7 +225,7 @@ int ia_css_queue_is_full(ia_css_queue_t *qhandle, bool *is_full)int ia_css_queue_get_free_space (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;@@ -257,7 +257,7 @@ int ia_css_queue_get_free_space(ia_css_queue_t *qhandle, uint32_t *size)int ia_css_queue_get_used_space (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;@@ -289,8 +289,8 @@ int ia_css_queue_get_used_space(ia_css_queue_t *qhandle, uint32_t *size)int ia_css_queue_peek (ia_css_queue_t *qhandle,u32 offset,uint32_t *element) { -u32 num_elems =0 ; -int error =0 ; +u32 num_elems; +int error;if ((!qhandle) || (!element))return -EINVAL ;@@ -338,7 +338,7 @@ int ia_css_queue_peek(ia_css_queue_t *qhandle, u32 offset, uint32_t *element)int ia_css_queue_is_empty (ia_css_queue_t *qhandle,bool *is_empty) { -int error =0 ; +int error;if ((!qhandle) || (!is_empty))return -EINVAL ;@@ -370,7 +370,7 @@ int ia_css_queue_is_empty(ia_css_queue_t *qhandle, bool *is_empty)int ia_css_queue_get_size (ia_css_queue_t *qhandle,uint32_t *size) { -int error =0 ; +int error;if ((!qhandle) || (!size))return -EINVAL ;