lkml.org 
[lkml]   [2023]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] PCI: mt7621: Use dev_err_probe()
From
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);


\
 
 \ /
  Last update: 2023-03-27 01:13    [W:0.082 / U:1.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site