Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1304117

[PATCH] tpm_crb: fix ptr_ret.cocci warnings

From kbuild test robot <lkp@intel.com>
Newsgroups linux.kernel
Subject [PATCH] tpm_crb: fix ptr_ret.cocci warnings
Date 2016-01-08 03:10 +0100
Message-ID <qOuF4-8n1-5@gated-at.bofh.it> (permalink)
References <qOuF4-8n1-7@gated-at.bofh.it> <qOtfZ-7iv-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


drivers/char/tpm/tpm_crb.c:297:1-3: WARNING: PTR_ERR_OR_ZERO can be used


 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

CC: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 tpm_crb.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -294,9 +294,7 @@ static int crb_map_io(struct acpi_device
 	memcpy_fromio(&pa, &priv->cca->rsp_pa, 8);
 	pa = le64_to_cpu(pa);
 	priv->rsp = crb_access(dev, priv, pa, ioread32(&priv->cca->rsp_size));
-	if (IS_ERR(priv->rsp))
-		return PTR_ERR(priv->rsp);
-	return 0;
+	return PTR_ERR_OR_ZERO(priv->rsp);
 }
 
 static int crb_acpi_add(struct acpi_device *device)

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 7/7] tpm_crb: Use devm_ioremap_resource Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2016-01-08 01:40 +0100
  Re: [PATCH v4 7/7] tpm_crb: Use devm_ioremap_resource kbuild test robot <lkp@intel.com> - 2016-01-08 03:10 +0100
  [PATCH] tpm_crb: fix ptr_ret.cocci warnings kbuild test robot <lkp@intel.com> - 2016-01-08 03:10 +0100
  Re: [PATCH v4 7/7] tpm_crb: Use devm_ioremap_resource Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-01-08 13:10 +0100
  Re: [PATCH v4 7/7] tpm_crb: Use devm_ioremap_resource Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-01-08 13:10 +0100

csiph-web