public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: ye.xingchen@zte.com.cn, sergio.paracuellos@gmail.com
Cc: lpieralisi@kernel.org, kw@linux.com, robh@kernel.org,
	bhelgaas@google.com, matthias.bgg@gmail.com,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] PCI: mt7621: Use dev_err_probe()
Date: Thu, 23 Mar 2023 09:21:21 +0100	[thread overview]
Message-ID: <aa682e7d-3a0c-b820-9978-3f9eb00fbfda@collabora.com> (raw)
In-Reply-To: <202303231145121987818@zte.com.cn>

Il 23/03/23 04:45, ye.xingchen@zte.com.cn ha scritto:
> From: Ye Xingchen <ye.xingchen@zte.com.cn>
> 
> Replace the open-code with dev_err_probe() to simplify the code.
> 
> Signed-off-by: Ye Xingchen <ye.xingchen@zte.com.cn>
> ---
>   drivers/pci/controller/pcie-mt7621.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c
> index 63a5f4463a9f..964de0e8c6a0 100644
> --- a/drivers/pci/controller/pcie-mt7621.c
> +++ b/drivers/pci/controller/pcie-mt7621.c
> @@ -220,10 +220,9 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
>   	}
> 
>   	port->pcie_rst = of_reset_control_get_exclusive(node, NULL);
> -	if (PTR_ERR(port->pcie_rst) == -EPROBE_DEFER) {
> -		dev_err(dev, "failed to get pcie%d reset control\n", slot);
> -		return PTR_ERR(port->pcie_rst);
> -	}
> +
> +	return dev_err_probe(dev, PTR_ERR(port->pcie_rst),
> +			     "failed to get pcie%d reset control\n", slot);

That's breaking this function. You're unconditionally returning.

I think that this is fine as it is, but if you really want to use dev_err_probe()
here, this could be...

ret = dev_err_probe(dev, PTR_ERR(port->pcie_rst), "failed ...." ...);
if (ret)
	return ret;

Regards,
Angelo

> 
>   	snprintf(name, sizeof(name), "pcie-phy%d", slot);
>   	port->phy = devm_of_phy_get(dev, node, name);



  parent reply	other threads:[~2023-03-23  8:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23  3:45 [PATCH] PCI: mt7621: Use dev_err_probe() ye.xingchen
2023-03-23  6:23 ` Sergio Paracuellos
2023-04-03  4:50   ` Dan Carpenter
2023-04-03  7:12     ` Sergio Paracuellos
2023-03-23  8:21 ` AngeloGioacchino Del Regno [this message]
2023-04-03  4:41 ` Dan Carpenter
2023-04-03  5:05   ` Sergio Paracuellos
2023-04-03  6:09     ` Dan Carpenter
2023-04-03  7:12       ` Sergio Paracuellos

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=aa682e7d-3a0c-b820-9978-3f9eb00fbfda@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sergio.paracuellos@gmail.com \
    --cc=ye.xingchen@zte.com.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