loop: fix passing zero to 'PTR_ERR' warning
diff mbox series

Message ID 1592988522-4350-1-git-send-email-dingxiang@cmss.chinamobile.com
State New
Headers show
Series
  • loop: fix passing zero to 'PTR_ERR' warning
Related show

Commit Message

Ding Xiang June 24, 2020, 8:48 a.m. UTC
Fix a static code checker warning:
    drivers/block/loop.c:798 loop_attr_backing_file_show()
    warn: passing zero to 'PTR_ERR'

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 drivers/block/loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Al Viro June 29, 2020, 8:54 p.m. UTC | #1
On Wed, Jun 24, 2020 at 04:48:42PM +0800, Ding Xiang wrote:
> Fix a static code checker warning:
>     drivers/block/loop.c:798 loop_attr_backing_file_show()
>     warn: passing zero to 'PTR_ERR'

Better fix the root cause of that the problem - bullshit checker,
that is...

Patch
diff mbox series

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 475e1a7..bcada87 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)
 	spin_unlock_irq(&lo->lo_lock);
 
 	if (IS_ERR_OR_NULL(p))
-		ret = PTR_ERR(p);
+		ret = PTR_ERR_OR_ZERO(p);
 	else {
 		ret = strlen(p);
 		memmove(buf, p, ret);