linux-remoteproc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remoteproc: Fix an error code in devm_rproc_alloc()
@ 2020-05-20 12:07 Dan Carpenter
  2020-05-20 14:47 ` Paul Cercueil
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2020-05-20 12:07 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Paul Cercueil
  Cc: Bjorn Andersson, linux-remoteproc, kernel-janitors

The comments say that this function should return NULL on error and the
caller expects NULL returns as well so I have modified the code to match.
Returning an ERR_PTR(-ENOMEM) would lead to an OOps.

Fixes: 305ac5a766b1 ("remoteproc: Add device-managed variants of rproc_alloc/rproc_add")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/remoteproc/remoteproc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 0cc015fabf78..9f04c30c4aaf 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2297,7 +2297,7 @@ struct rproc *devm_rproc_alloc(struct device *dev, const char *name,
 
 	ptr = devres_alloc(devm_rproc_free, sizeof(*ptr), GFP_KERNEL);
 	if (!ptr)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 
 	rproc = rproc_alloc(dev, name, ops, firmware, len);
 	if (rproc) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] remoteproc: Fix an error code in devm_rproc_alloc()
  2020-05-20 12:07 [PATCH] remoteproc: Fix an error code in devm_rproc_alloc() Dan Carpenter
@ 2020-05-20 14:47 ` Paul Cercueil
  2020-05-20 19:13 ` Bjorn Andersson
  2020-05-20 20:00 ` patchwork-bot+linux-remoteproc
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Cercueil @ 2020-05-20 14:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ohad Ben-Cohen, Bjorn Andersson, linux-remoteproc, kernel-janitors

Hi Dan,

Le mer. 20 mai 2020 à 15:07, Dan Carpenter <dan.carpenter@oracle.com> 
a écrit :
> The comments say that this function should return NULL on error and 
> the
> caller expects NULL returns as well so I have modified the code to 
> match.
> Returning an ERR_PTR(-ENOMEM) would lead to an OOps.
> 
> Fixes: 305ac5a766b1 ("remoteproc: Add device-managed variants of 
> rproc_alloc/rproc_add")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Alright, makes sense.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/remoteproc/remoteproc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c 
> b/drivers/remoteproc/remoteproc_core.c
> index 0cc015fabf78..9f04c30c4aaf 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2297,7 +2297,7 @@ struct rproc *devm_rproc_alloc(struct device 
> *dev, const char *name,
> 
>  	ptr = devres_alloc(devm_rproc_free, sizeof(*ptr), GFP_KERNEL);
>  	if (!ptr)
> -		return ERR_PTR(-ENOMEM);
> +		return NULL;
> 
>  	rproc = rproc_alloc(dev, name, ops, firmware, len);
>  	if (rproc) {
> --
> 2.26.2
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] remoteproc: Fix an error code in devm_rproc_alloc()
  2020-05-20 12:07 [PATCH] remoteproc: Fix an error code in devm_rproc_alloc() Dan Carpenter
  2020-05-20 14:47 ` Paul Cercueil
@ 2020-05-20 19:13 ` Bjorn Andersson
  2020-05-20 20:00 ` patchwork-bot+linux-remoteproc
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2020-05-20 19:13 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ohad Ben-Cohen, Paul Cercueil, linux-remoteproc, kernel-janitors

On Wed 20 May 05:07 PDT 2020, Dan Carpenter wrote:

> The comments say that this function should return NULL on error and the
> caller expects NULL returns as well so I have modified the code to match.
> Returning an ERR_PTR(-ENOMEM) would lead to an OOps.
> 
> Fixes: 305ac5a766b1 ("remoteproc: Add device-managed variants of rproc_alloc/rproc_add")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by and applied

Thanks,
Bjorn

> ---
>  drivers/remoteproc/remoteproc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 0cc015fabf78..9f04c30c4aaf 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2297,7 +2297,7 @@ struct rproc *devm_rproc_alloc(struct device *dev, const char *name,
>  
>  	ptr = devres_alloc(devm_rproc_free, sizeof(*ptr), GFP_KERNEL);
>  	if (!ptr)
> -		return ERR_PTR(-ENOMEM);
> +		return NULL;
>  
>  	rproc = rproc_alloc(dev, name, ops, firmware, len);
>  	if (rproc) {
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] remoteproc: Fix an error code in devm_rproc_alloc()
  2020-05-20 12:07 [PATCH] remoteproc: Fix an error code in devm_rproc_alloc() Dan Carpenter
  2020-05-20 14:47 ` Paul Cercueil
  2020-05-20 19:13 ` Bjorn Andersson
@ 2020-05-20 20:00 ` patchwork-bot+linux-remoteproc
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-remoteproc @ 2020-05-20 20:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-remoteproc

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next).

On Wed, 20 May 2020 15:07:05 +0300 you wrote:
> The comments say that this function should return NULL on error and the
> caller expects NULL returns as well so I have modified the code to match.
> Returning an ERR_PTR(-ENOMEM) would lead to an OOps.
> 
> Fixes: 305ac5a766b1 ("remoteproc: Add device-managed variants of rproc_alloc/rproc_add")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> [...]


Here is a summary with links:
  - remoteproc: Fix an error code in devm_rproc_alloc()
    https://git.kernel.org/andersson/remoteproc/c/7dcef3988eedbfb40e7e95a821966a029a5a465b

You are awesome, thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-20 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 12:07 [PATCH] remoteproc: Fix an error code in devm_rproc_alloc() Dan Carpenter
2020-05-20 14:47 ` Paul Cercueil
2020-05-20 19:13 ` Bjorn Andersson
2020-05-20 20:00 ` patchwork-bot+linux-remoteproc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).