All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dca: Use PTR_ERR_OR_ZERO() to simplify code
@ 2020-05-07 11:12 Tang Bin
  0 siblings, 0 replies; only message in thread
From: Tang Bin @ 2020-05-07 11:12 UTC (permalink / raw)
  To: gregkh, allison, rfontana, kstewart, mpe, tglx
  Cc: linux-kernel, Tang Bin, Zhang Shengju

The function PTR_ERR_OR_ZERO() contains the check of
IS_ERR() and the return of PTR_ERR() or zero.

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/dca/dca-sysfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c
index eb25627b0..21ebd0af2 100644
--- a/drivers/dca/dca-sysfs.c
+++ b/drivers/dca/dca-sysfs.c
@@ -24,9 +24,7 @@ int dca_sysfs_add_req(struct dca_provider *dca, struct device *dev, int slot)
 
 	cd = device_create(dca_class, dca->cd, MKDEV(0, slot + 1), NULL,
 			   "requester%d", req_count++);
-	if (IS_ERR(cd))
-		return PTR_ERR(cd);
-	return 0;
+	return PTR_ERR_OR_ZERO(cd);
 }
 
 void dca_sysfs_remove_req(struct dca_provider *dca, int slot)
-- 
2.20.1.windows.1




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-05-07 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 11:12 [PATCH] dca: Use PTR_ERR_OR_ZERO() to simplify code Tang Bin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.