diff mbox series

[-next] net: ieee802154: mcr20a: Switch to use dev_err_probe() helper

Message ID 20220915071258.678536-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Headers show
Series [-next] net: ieee802154: mcr20a: Switch to use dev_err_probe() helper | expand

Commit Message

Yang Yingliang Sept. 15, 2022, 7:12 a.m. UTC
dev_err() can be replace with dev_err_probe() which will check if error
code is -EPROBE_DEFER.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ieee802154/mcr20a.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Stefan Schmidt Oct. 12, 2022, 8:50 a.m. UTC | #1
Hello.

On 15.09.22 09:12, Yang Yingliang wrote:
> dev_err() can be replace with dev_err_probe() which will check if error
> code is -EPROBE_DEFER.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/net/ieee802154/mcr20a.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index 2fe0e4a0a0c4..f53d185e0568 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -1233,12 +1233,9 @@ mcr20a_probe(struct spi_device *spi)
>   	}
>   
>   	rst_b = devm_gpiod_get(&spi->dev, "rst_b", GPIOD_OUT_HIGH);
> -	if (IS_ERR(rst_b)) {
> -		ret = PTR_ERR(rst_b);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(&spi->dev, "Failed to get 'rst_b' gpio: %d", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(rst_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(rst_b),
> +				     "Failed to get 'rst_b' gpio");
>   
>   	/* reset mcr20a */
>   	usleep_range(10, 20);


This patch has been applied to the wpan-next tree and will be
part of the next pull request to net-next. Thanks!

regards
Stefan Schmidt
diff mbox series

Patch

diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
index 2fe0e4a0a0c4..f53d185e0568 100644
--- a/drivers/net/ieee802154/mcr20a.c
+++ b/drivers/net/ieee802154/mcr20a.c
@@ -1233,12 +1233,9 @@  mcr20a_probe(struct spi_device *spi)
 	}
 
 	rst_b = devm_gpiod_get(&spi->dev, "rst_b", GPIOD_OUT_HIGH);
-	if (IS_ERR(rst_b)) {
-		ret = PTR_ERR(rst_b);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&spi->dev, "Failed to get 'rst_b' gpio: %d", ret);
-		return ret;
-	}
+	if (IS_ERR(rst_b))
+		return dev_err_probe(&spi->dev, PTR_ERR(rst_b),
+				     "Failed to get 'rst_b' gpio");
 
 	/* reset mcr20a */
 	usleep_range(10, 20);