diff mbox series

loop: Fix passing zero to 'PTR_ERR' warning

Message ID 20201112145233.53060-1-yuehaibing@huawei.com (mailing list archive)
State New, archived
Headers show
Series loop: Fix passing zero to 'PTR_ERR' warning | expand

Commit Message

Yue Haibing Nov. 12, 2020, 2:52 p.m. UTC
Fix smatch warning:

drivers/block/loop.c:799 loop_attr_backing_file_show() warn: passing zero to 'PTR_ERR'

file_path() never returns 0, so use IS_ERR instead of
IS_ERR_OR_NULL to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 83701c2ae3ca..65d392307c6a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -795,7 +795,7 @@  static ssize_t loop_attr_backing_file_show(struct loop_device *lo, char *buf)
 		p = file_path(lo->lo_backing_file, buf, PAGE_SIZE - 1);
 	spin_unlock_irq(&lo->lo_lock);
 
-	if (IS_ERR_OR_NULL(p))
+	if (IS_ERR(p))
 		ret = PTR_ERR(p);
 	else {
 		ret = strlen(p);