[PATCH] OPP: Fix an un-initialized variable usage

Christophe JAILLET posted 1 patch 3 years, 7 months ago
drivers/opp/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] OPP: Fix an un-initialized variable usage
Posted by Christophe JAILLET 3 years, 7 months ago
smatch complains that 'ret' may be returned un-initialized.

Explicitly return 0 if we reach the end of the function (should
'opp_table->clk_count' be 0).

Fixes: 8174a3a613af ("OPP: Provide a simple implementation to configure multiple clocks")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/opp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 77d1ba3a4154..e87567dbe99f 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -873,7 +873,7 @@ int dev_pm_opp_config_clks_simple(struct device *dev,
 		}
 	}
 
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_config_clks_simple);
 
-- 
2.34.1
Re: [PATCH] OPP: Fix an un-initialized variable usage
Posted by Viresh Kumar 3 years, 7 months ago
On 15-08-22, 14:44, Christophe JAILLET wrote:
> smatch complains that 'ret' may be returned un-initialized.
> 
> Explicitly return 0 if we reach the end of the function (should
> 'opp_table->clk_count' be 0).
> 
> Fixes: 8174a3a613af ("OPP: Provide a simple implementation to configure multiple clocks")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/opp/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/core.c b/drivers/opp/core.c
> index 77d1ba3a4154..e87567dbe99f 100644
> --- a/drivers/opp/core.c
> +++ b/drivers/opp/core.c
> @@ -873,7 +873,7 @@ int dev_pm_opp_config_clks_simple(struct device *dev,
>  		}
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  EXPORT_SYMBOL_GPL(dev_pm_opp_config_clks_simple);

Applied. Thanks.

-- 
viresh