diff mbox series

[-next,2/2] PCI: switch to use dev_err_probe()

Message ID 20220817084444.2876059-2-yangyingliang@huawei.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series [-next,1/2] PCI: fix possible memory leak in error case in pci_setup_device() | expand

Commit Message

Yang Yingliang Aug. 17, 2022, 8:44 a.m. UTC
Use dev_err_probe() to simplify code and print error code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/pci/probe.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Christophe JAILLET Aug. 17, 2022, 9:11 a.m. UTC | #1
Le 17/08/2022 à 10:44, Yang Yingliang a écrit :
> Use dev_err_probe() to simplify code and print error code.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/pci/probe.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 0e947f24153e..f2430da8a30b 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -3054,10 +3054,9 @@ int pci_host_probe(struct pci_host_bridge *bridge)
>   	int ret;
>   
>   	ret = pci_scan_root_bus_bridge(bridge);
> -	if (ret < 0) {
> -		dev_err(bridge->dev.parent, "Scanning root bridge failed");
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(bridge->dev.parent, ret,
> +				     "Scanning root bridge failed");
>   
>   	bus = bridge->bus;
>   

Nit: you could also add a \n at the end of the message.

Just my 2c,

CJ
diff mbox series

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0e947f24153e..f2430da8a30b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -3054,10 +3054,9 @@  int pci_host_probe(struct pci_host_bridge *bridge)
 	int ret;
 
 	ret = pci_scan_root_bus_bridge(bridge);
-	if (ret < 0) {
-		dev_err(bridge->dev.parent, "Scanning root bridge failed");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(bridge->dev.parent, ret,
+				     "Scanning root bridge failed");
 
 	bus = bridge->bus;