Skip to contentSkip to conversation

misc: mic: Use PTR_ERR_OR_ZERO()

PATCH New Vasyl Gomonovych 1 participant 1 message Nov 28, 2017 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: mic: Use PTR_ERR_OR_ZERO()

Fix ptr_ret.cocci warnings:
drivers/misc/mic/scif/scif_epd.h:168: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

---
 drivers/misc/mic/scif/scif_epd.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/misc/mic/scif/scif_epd.h +1 -3
index 1771d7a9b8d0..8dad98edeb56 100644
@@ -165,9 +165,7 @@ static inline int scif_verify_epd(struct scif_endpt *ep)
 static inline int scif_anon_inode_getfile(scif_epd_t epd)
 {
 	epd->anon = anon_inode_getfile("scif", &scif_anon_fops, NULL, 0);
-	if (IS_ERR(epd->anon))
-		return PTR_ERR(epd->anon);
-	return 0;
+	return PTR_ERR_OR_ZERO(epd->anon);
 }
 
 static inline void scif_anon_inode_fput(scif_epd_t epd)
Signature · 1 line
1.9.1