2019-05-25 08:19:49

by Hariprasad Kelam

[permalink] [raw]
Subject: [PATCH] drivers/dca: fix warning PTR_ERR_OR_ZERO can be used

fix below warning reported by coccicheck

./drivers/dca/dca-sysfs.c:43:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Signed-off-by: Hariprasad Kelam <[email protected]>
---
drivers/dca/dca-sysfs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/dca/dca-sysfs.c b/drivers/dca/dca-sysfs.c
index 126cf29..5270705 100644
--- a/drivers/dca/dca-sysfs.c
+++ b/drivers/dca/dca-sysfs.c
@@ -40,9 +40,8 @@ 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.7.4