diff mbox series

nfc: st95hf: Make use of the helper function dev_err_probe()

Message ID 20210916153614.16523-1-caihuoqing@baidu.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series nfc: st95hf: Make use of the helper function dev_err_probe() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 3 maintainers not CCed: wengjianfeng@yulong.com kuba@kernel.org davem@davemloft.net
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: line length of 100 exceeds 80 columns
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Cai,Huoqing Sept. 16, 2021, 3:36 p.m. UTC
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@baidu.com>
---
 drivers/nfc/st95hf/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Krzysztof Kozlowski Sept. 16, 2021, 4:56 p.m. UTC | #1
On 16/09/2021 17:36, Cai Huoqing wrote:
> 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@baidu.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");

I think the preferred approach was Rob's dev_err removal. See:

https://lore.kernel.org/lkml/20200911152943.GA17780@kozik-lap/
https://lore.kernel.org/lkml/CAL_Jsq+ajm5aiAJfQdS2+2DO1ynBDHWha_7TsA4u-2qwd87y6g@mail.gmail.com/

P.S. You need to Cc all folks and all lists. The cc-list here is too short.

Best regards,
Krzysztof
diff mbox series

Patch

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) {