[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210916153614.16523-1-caihuoqing@baidu.com>
Date: Thu, 16 Sep 2021 23:36:13 +0800
From: Cai Huoqing <caihuoqing@...du.com>
To: <caihuoqing@...du.com>
CC: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] nfc: st95hf: Make use of the helper function dev_err_probe()
When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.
Signed-off-by: Cai Huoqing <caihuoqing@...du.com>
---
drivers/nfc/st95hf/core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/nfc/st95hf/core.c b/drivers/nfc/st95hf/core.c
index d16cf3ff644e..8337c0e0c964 100644
--- a/drivers/nfc/st95hf/core.c
+++ b/drivers/nfc/st95hf/core.c
@@ -1087,10 +1087,9 @@ static int st95hf_probe(struct spi_device *nfc_spi_dev)
st95context->st95hf_supply =
devm_regulator_get(&nfc_spi_dev->dev,
"st95hfvin");
- if (IS_ERR(st95context->st95hf_supply)) {
- dev_err(&nfc_spi_dev->dev, "failed to acquire regulator\n");
- return PTR_ERR(st95context->st95hf_supply);
- }
+ if (IS_ERR(st95context->st95hf_supply))
+ return dev_err_probe(&nfc_spi_dev->dev, PTR_ERR(st95context->st95hf_supply),
+ "failed to acquire regulator\n");
ret = regulator_enable(st95context->st95hf_supply);
if (ret) {
--
2.25.1
Powered by blists - more mailing lists