diff mbox series

[-next] opp: Fix return in _opp_add_static_v2()

Message ID 20211008074652.19700-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Delegated to: viresh kumar
Headers show
Series [-next] opp: Fix return in _opp_add_static_v2() | expand

Commit Message

Yue Haibing Oct. 8, 2021, 7:46 a.m. UTC
Fix sparse warning:
drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'

For duplicate OPPs 'ret' be set to zero.

Fixes: deac8703da5f ("PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/opp/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar Oct. 8, 2021, 8:04 a.m. UTC | #1
On 08-10-21, 15:46, YueHaibing wrote:
> Fix sparse warning:
> drivers/opp/of.c:924 _opp_add_static_v2() warn: passing zero to 'ERR_PTR'
> 
> For duplicate OPPs 'ret' be set to zero.
> 
> Fixes: deac8703da5f ("PM / OPP: _of_add_opp_table_v2(): increment count only if OPP is added")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/opp/of.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index 2a97c6535c4c..c32ae7497392 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -921,7 +921,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
>  free_opp:
>  	_opp_free(new_opp);
>  
> -	return ERR_PTR(ret);
> +	return ret ? ERR_PTR(ret) : NULL;
>  }
>  
>  /* Initializes OPP tables based on new bindings */

Applied. Thanks.
diff mbox series

Patch

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 2a97c6535c4c..c32ae7497392 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -921,7 +921,7 @@  static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table,
 free_opp:
 	_opp_free(new_opp);
 
-	return ERR_PTR(ret);
+	return ret ? ERR_PTR(ret) : NULL;
 }
 
 /* Initializes OPP tables based on new bindings */