All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: musb: Fix missing error code in mpfs_probe()
@ 2022-06-24  7:25 ` Jiapeng Chong
  0 siblings, 0 replies; 4+ messages in thread
From: Jiapeng Chong @ 2022-06-24  7:25 UTC (permalink / raw)
  To: lewis.hanly
  Cc: conor.dooley, b-liu, gregkh, linux-riscv, linux-usb,
	linux-kernel, Jiapeng Chong

The error code is missing in this code scenario, add the error code
'-ENOMEM' to the return value 'ret'.

This was found by coccicheck:

drivers/usb/musb/mpfs.c:185 mpfs_probe() warn: missing error code 'ret'.

Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/usb/musb/mpfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 99666ef8af06..c8bf6570bcc4 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
 	glue->clk = clk;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
+	if (!pdata) {
+		ret = -ENOMEM;
 		goto err_clk_disable;
+	}
 
 	pdata->config = &mpfs_musb_hdrc_config;
 	pdata->platform_ops = &mpfs_ops;
-- 
2.20.1.7.g153144c


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

* [PATCH] usb: musb: Fix missing error code in mpfs_probe()
@ 2022-06-24  7:25 ` Jiapeng Chong
  0 siblings, 0 replies; 4+ messages in thread
From: Jiapeng Chong @ 2022-06-24  7:25 UTC (permalink / raw)
  To: lewis.hanly
  Cc: conor.dooley, b-liu, gregkh, linux-riscv, linux-usb,
	linux-kernel, Jiapeng Chong

The error code is missing in this code scenario, add the error code
'-ENOMEM' to the return value 'ret'.

This was found by coccicheck:

drivers/usb/musb/mpfs.c:185 mpfs_probe() warn: missing error code 'ret'.

Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/usb/musb/mpfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 99666ef8af06..c8bf6570bcc4 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
 	glue->clk = clk;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
+	if (!pdata) {
+		ret = -ENOMEM;
 		goto err_clk_disable;
+	}
 
 	pdata->config = &mpfs_musb_hdrc_config;
 	pdata->platform_ops = &mpfs_ops;
-- 
2.20.1.7.g153144c


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] usb: musb: Fix missing error code in mpfs_probe()
  2022-06-24  7:25 ` Jiapeng Chong
@ 2022-06-24 11:36   ` Greg KH
  -1 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-06-24 11:36 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: lewis.hanly, conor.dooley, b-liu, linux-riscv, linux-usb, linux-kernel

On Fri, Jun 24, 2022 at 03:25:15PM +0800, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-ENOMEM' to the return value 'ret'.
> 
> This was found by coccicheck:
> 
> drivers/usb/musb/mpfs.c:185 mpfs_probe() warn: missing error code 'ret'.
> 
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/usb/musb/mpfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
> index 99666ef8af06..c8bf6570bcc4 100644
> --- a/drivers/usb/musb/mpfs.c
> +++ b/drivers/usb/musb/mpfs.c
> @@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
>  	glue->clk = clk;
>  
>  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata)
> +	if (!pdata) {
> +		ret = -ENOMEM;
>  		goto err_clk_disable;
> +	}
>  
>  	pdata->config = &mpfs_musb_hdrc_config;
>  	pdata->platform_ops = &mpfs_ops;
> -- 
> 2.20.1.7.g153144c
> 

Dan beat you to it, and provided a better fix:
	https://lore.kernel.org/r/YrVmLEc/FOEzNdzj@kili

thanks,

greg k-h

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

* Re: [PATCH] usb: musb: Fix missing error code in mpfs_probe()
@ 2022-06-24 11:36   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-06-24 11:36 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: lewis.hanly, conor.dooley, b-liu, linux-riscv, linux-usb, linux-kernel

On Fri, Jun 24, 2022 at 03:25:15PM +0800, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-ENOMEM' to the return value 'ret'.
> 
> This was found by coccicheck:
> 
> drivers/usb/musb/mpfs.c:185 mpfs_probe() warn: missing error code 'ret'.
> 
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/usb/musb/mpfs.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
> index 99666ef8af06..c8bf6570bcc4 100644
> --- a/drivers/usb/musb/mpfs.c
> +++ b/drivers/usb/musb/mpfs.c
> @@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
>  	glue->clk = clk;
>  
>  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata)
> +	if (!pdata) {
> +		ret = -ENOMEM;
>  		goto err_clk_disable;
> +	}
>  
>  	pdata->config = &mpfs_musb_hdrc_config;
>  	pdata->platform_ops = &mpfs_ops;
> -- 
> 2.20.1.7.g153144c
> 

Dan beat you to it, and provided a better fix:
	https://lore.kernel.org/r/YrVmLEc/FOEzNdzj@kili

thanks,

greg k-h

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2022-06-24 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24  7:25 [PATCH] usb: musb: Fix missing error code in mpfs_probe() Jiapeng Chong
2022-06-24  7:25 ` Jiapeng Chong
2022-06-24 11:36 ` Greg KH
2022-06-24 11:36   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.