[PATCH] sync_file: fix ptr_ret.cocci warnings

kbuild test robot fengguang.wu at intel.com
Thu Apr 13 10:15:47 UTC 2017


drivers/dma-buf/sync_file.c:36: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

Signed-off-by: Fengguang Wu <fengguang.wu at intel.com>
---

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

--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -33,9 +33,7 @@ static int fence_file_init(struct fence_
 {
 	fence_file->file = anon_inode_getfile("fence_file", fops,
 					     fence_file, 0);
-	if (IS_ERR(fence_file->file))
-		return PTR_ERR(fence_file->file);
-	return 0;
+	return PTR_ERR_OR_ZERO(fence_file->file);
 }
 
 static struct sync_file *sync_file_alloc(void)


More information about the dri-devel mailing list