diff mbox series

[v2,06/14] media: staging: rkisp1: params: in the isr, return if buffer list is empty

Message ID 20200815103734.31153-7-dafna.hirschfeld@collabora.com (mailing list archive)
State New, archived
Headers show
Series media: staging: rkisp1: various bug fixes | expand

Commit Message

Dafna Hirschfeld Aug. 15, 2020, 10:37 a.m. UTC
Currently the code in the isr checks if the buffer list is not
empty before referencing a buffer and then check again if the
buffer is not NULL. Instead we can save one 'if' statement by
returning if the buffers list is empty.
Also remove non-helpful inline doc 'get one empty buffer'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/staging/media/rkisp1/rkisp1-params.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Helen Mae Koike Fornazier Aug. 17, 2020, 9:47 p.m. UTC | #1
On 8/15/20 7:37 AM, Dafna Hirschfeld wrote:
> Currently the code in the isr checks if the buffer list is not
> empty before referencing a buffer and then check again if the
> buffer is not NULL. Instead we can save one 'if' statement by
> returning if the buffers list is empty.
> Also remove non-helpful inline doc 'get one empty buffer'
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

Acked-by: Helen Koike <helen.koike@collabora.com>

Thanks
Helen

> ---
>  drivers/staging/media/rkisp1/rkisp1-params.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
> index 6a76c586e916..86bbd01e18c7 100644
> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
> @@ -1206,16 +1206,14 @@ void rkisp1_params_isr(struct rkisp1_device *rkisp1)
>  		return;
>  	}
>  
> -	/* get one empty buffer */
> -	if (!list_empty(&params->params))
> -		cur_buf = list_first_entry(&params->params,
> -					   struct rkisp1_buffer, queue);
> -
> -	if (!cur_buf) {
> +	if (list_empty(&params->params)) {
>  		spin_unlock(&params->config_lock);
>  		return;
>  	}
>  
> +	cur_buf = list_first_entry(&params->params,
> +				   struct rkisp1_buffer, queue);
> +
>  	new_params = (struct rkisp1_params_cfg *)(cur_buf->vaddr[0]);
>  
>  	rkisp1_isp_isr_other_config(params, new_params);
>
diff mbox series

Patch

diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
index 6a76c586e916..86bbd01e18c7 100644
--- a/drivers/staging/media/rkisp1/rkisp1-params.c
+++ b/drivers/staging/media/rkisp1/rkisp1-params.c
@@ -1206,16 +1206,14 @@  void rkisp1_params_isr(struct rkisp1_device *rkisp1)
 		return;
 	}
 
-	/* get one empty buffer */
-	if (!list_empty(&params->params))
-		cur_buf = list_first_entry(&params->params,
-					   struct rkisp1_buffer, queue);
-
-	if (!cur_buf) {
+	if (list_empty(&params->params)) {
 		spin_unlock(&params->config_lock);
 		return;
 	}
 
+	cur_buf = list_first_entry(&params->params,
+				   struct rkisp1_buffer, queue);
+
 	new_params = (struct rkisp1_params_cfg *)(cur_buf->vaddr[0]);
 
 	rkisp1_isp_isr_other_config(params, new_params);