diff mbox series

media: venus: venus_helper_get_bufreq(): req is never NULL

Message ID 44d3b224-5ea4-3d18-4aff-0e938fd8503c@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series media: venus: venus_helper_get_bufreq(): req is never NULL | expand

Commit Message

Hans Verkuil July 12, 2022, 7:56 a.m. UTC
Fix a smatch error:

drivers/media/platform/qcom/venus/helpers.c: drivers/media/platform/qcom/venus/helpers.c:678 venus_helper_get_bufreq() error: we previously assumed 'req' could be null (see line 674)

After checking how venus_helper_get_bufreq() is called it is clear that
req is never NULL, so just drop the check.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---

Comments

Hans Verkuil July 12, 2022, 10:39 a.m. UTC | #1
Please ignore, there is another 'if (req)' later in this function.

I'll post a v2 later today.

	Hans

On 7/12/22 09:56, Hans Verkuil wrote:
> Fix a smatch error:
> 
> drivers/media/platform/qcom/venus/helpers.c: drivers/media/platform/qcom/venus/helpers.c:678 venus_helper_get_bufreq() error: we previously assumed 'req' could be null (see line 674)
> 
> After checking how venus_helper_get_bufreq() is called it is clear that
> req is never NULL, so just drop the check.
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
> index 5c1104379c49..ad8aaebf86be 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -671,8 +671,7 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
>  	unsigned int i;
>  	int ret;
>  
> -	if (req)
> -		memset(req, 0, sizeof(*req));
> +	memset(req, 0, sizeof(*req));
>  
>  	if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2)
>  		req->count_min = inst->fw_min_cnt;
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 5c1104379c49..ad8aaebf86be 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -671,8 +671,7 @@  int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
 	unsigned int i;
 	int ret;
 
-	if (req)
-		memset(req, 0, sizeof(*req));
+	memset(req, 0, sizeof(*req));
 
 	if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2)
 		req->count_min = inst->fw_min_cnt;