diff mbox

sync_file: fix ptr_ret.cocci warnings

Message ID 20170413101547.GA27778@lkp-wsm-ep2 (mailing list archive)
State New, archived
Headers show

Commit Message

Fengguang Wu April 13, 2017, 10:15 a.m. UTC
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@intel.com>
---

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

Patch

--- 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)