Skip to contentSkip to conversation

dca: Use PTR_ERR_OR_ZERO() in dca_sysfs_add_req()

PATCH New Markus Elfring 1 participant 1 message Sep 6, 2019 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dca: Use PTR_ERR_OR_ZERO() in dca_sysfs_add_req()

From: Markus Elfring <[email protected]>
Date: Fri, 6 Sep 2019 18:05:21 +0200

Simplify this function implementation by using a known function.

This issue was detected by using the Coccinelle software.

---
 drivers/dca/dca-sysfs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/dca/dca-sysfs.c +1 -3
index eb25627b059d..21ebd0af268b 100644
@@ -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.23.0