Linux USB
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Cc: lewis.hanly@microchip.com, conor.dooley@microchip.com,
	b-liu@ti.com, linux-riscv@lists.infradead.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: musb: Fix missing error code in mpfs_probe()
Date: Fri, 24 Jun 2022 13:36:42 +0200	[thread overview]
Message-ID: <YrWhyppxkpQQ6Y8U@kroah.com> (raw)
In-Reply-To: <20220624072515.123646-1-jiapeng.chong@linux.alibaba.com>

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

      reply	other threads:[~2022-06-24 11:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  7:25 [PATCH] usb: musb: Fix missing error code in mpfs_probe() Jiapeng Chong
2022-06-24 11:36 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrWhyppxkpQQ6Y8U@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=b-liu@ti.com \
    --cc=conor.dooley@microchip.com \
    --cc=jiapeng.chong@linux.alibaba.com \
    --cc=lewis.hanly@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox