diff mbox series

[6/9] media: qcom: venus: fix incorrect return value

Message ID aca1fc4a0f8b503e77365bd7d7d06d2dfa2d7d91.1696586632.git.hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series media: fix smatch warnings | expand

Commit Message

Hans Verkuil Oct. 6, 2023, 10:08 a.m. UTC
'pd' can be NULL, and in that case it shouldn't be passed to
PTR_ERR. Fixes a smatch warning:

drivers/media/platform/qcom/venus/pm_helpers.c:873 vcodec_domains_get() warn: passing zero to 'PTR_ERR'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
CC: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
CC: Vikash Garodia <quic_vgarodia@quicinc.com>
CC: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
---
 drivers/media/platform/qcom/venus/pm_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bryan O'Donoghue Oct. 6, 2023, 10:13 a.m. UTC | #1
On 06/10/2023 11:08, Hans Verkuil wrote:
> 'pd' can be NULL, and in that case it shouldn't be passed to
> PTR_ERR. Fixes a smatch warning:
> 
> drivers/media/platform/qcom/venus/pm_helpers.c:873 vcodec_domains_get() warn: passing zero to 'PTR_ERR'
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> CC: Stanimir Varbanov <stanimir.k.varbanov@gmail.com>
> CC: Vikash Garodia <quic_vgarodia@quicinc.com>
> CC: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
> ---
>   drivers/media/platform/qcom/venus/pm_helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index 48c9084bb4db..a1b127caa90a 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -870,7 +870,7 @@ static int vcodec_domains_get(struct venus_core *core)
>   		pd = dev_pm_domain_attach_by_name(dev,
>   						  res->vcodec_pmdomains[i]);
>   		if (IS_ERR_OR_NULL(pd))
> -			return PTR_ERR(pd) ? : -ENODATA;
> +			return pd ? PTR_ERR(pd) : -ENODATA;
>   		core->pmdomains[i] = pd;
>   	}
>   

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 48c9084bb4db..a1b127caa90a 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -870,7 +870,7 @@  static int vcodec_domains_get(struct venus_core *core)
 		pd = dev_pm_domain_attach_by_name(dev,
 						  res->vcodec_pmdomains[i]);
 		if (IS_ERR_OR_NULL(pd))
-			return PTR_ERR(pd) ? : -ENODATA;
+			return pd ? PTR_ERR(pd) : -ENODATA;
 		core->pmdomains[i] = pd;
 	}