[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLUdXBoMJdSzeZdq@gerhold.net>
Date: Mon, 17 Jul 2023 12:52:12 +0200
From: Stephan Gerhold <stephan@...hold.net>
To: djakov@...nel.org
Cc: konrad.dybcio@...aro.org, andersson@...nel.org,
linux-arm-msm@...r.kernel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] interconnect: qcom: icc-rpm: Initialize ret variable to
fix smatch error
On Mon, Jul 17, 2023 at 10:34:29AM +0300, djakov@...nel.org wrote:
> From: Georgi Djakov <djakov@...nel.org>
>
> Fix the following smatch error:
> drivers/interconnect/qcom/icc-rpm.c:243 qcom_icc_rpm_set() error: uninitialized symbol 'ret'.
>
> Fixes: 32846c4a8f2a ("interconnect: qcom: icc-rpm: Set bandwidth on both contexts")
> Signed-off-by: Georgi Djakov <djakov@...nel.org>
Thanks for spotting this!
> ---
> drivers/interconnect/qcom/icc-rpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
> index 612390b9eb18..6718cc648d75 100644
> --- a/drivers/interconnect/qcom/icc-rpm.c
> +++ b/drivers/interconnect/qcom/icc-rpm.c
> @@ -206,7 +206,7 @@ static int qcom_icc_qos_set(struct icc_node *node)
>
> static int qcom_icc_rpm_set(struct qcom_icc_node *qn, u64 *bw)
> {
> - int ret, rpm_ctx = 0;
> + int ret = 0, rpm_ctx = 0;
> u64 bw_bps;
>
> if (qn->qos.ap_owned)
I think it would be a bit clearer to change the "return ret;" at the end
of the function to "return 0;". The ret variable is only used inside the
for loop and always handled there, so we always want to return 0 when
reaching the end of the function.
Thanks,
Stephan
Powered by blists - more mailing lists