public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Mingxuan Xiang <mx_xiang@hust.edu.cn>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"hust-os-kernel-patches@googlegroups.com" 
	<hust-os-kernel-patches@googlegroups.com>,
	Dongliang Mu <dzm91@hust.edu.cn>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] usb: dwc3: host: remove dead code in dwc3_host_get_irq()
Date: Fri, 24 Mar 2023 18:30:06 +0000	[thread overview]
Message-ID: <20230324183004.3o7twv46duc2oufe@synopsys.com> (raw)
In-Reply-To: <20230324060934.1686859-1-mx_xiang@hust.edu.cn>

On Fri, Mar 24, 2023, Mingxuan Xiang wrote:
> According to the description of platform_get_irq()
>  * Return: non-zero IRQ number on success, 
>  			negative error number on failure.
> and the code, platform_get_irq() will return -EINVAL
> instead of IRQ0.
> 
> So platform_get_irq() no longer returns 0, there is no
> need to check whether the return value is 0.
> 
> Found by Smatch:
> drivers/usb/dwc3/host.c:60 dwc3_host_get_irq() 
> 	warn: platform_get_irq() does not return zero
> 
> Signed-off-by: Mingxuan Xiang <mx_xiang@hust.edu.cn>
> ---
> v2->v3: remove curly braces
> v1->v2: remove redundant goto
> Only compile tested.
> ---
>  drivers/usb/dwc3/host.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index f6f13e7f1ba1..61f57fe5bb78 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -52,13 +52,8 @@ static int dwc3_host_get_irq(struct dwc3 *dwc)
>  		goto out;
>  
>  	irq = platform_get_irq(dwc3_pdev, 0);
> -	if (irq > 0) {
> +	if (irq > 0)
>  		dwc3_host_fill_xhci_irq_res(dwc, irq, NULL);
> -		goto out;
> -	}
> -
> -	if (!irq)
> -		irq = -EINVAL;
>  
>  out:
>  	return irq;
> -- 
> 2.39.2
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

      parent reply	other threads:[~2023-03-24 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  6:09 [PATCH v3] usb: dwc3: host: remove dead code in dwc3_host_get_irq() Mingxuan Xiang
2023-03-24  6:20 ` Dan Carpenter
2023-03-24 18:30 ` Thinh Nguyen [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=20230324183004.3o7twv46duc2oufe@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=dzm91@hust.edu.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=hust-os-kernel-patches@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mx_xiang@hust.edu.cn \
    /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