2020-06-24 08:50:31

by Ding Xiang

[permalink] [raw]
Subject: [PATCH] loop: fix passing zero to 'PTR_ERR' warning

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 <[email protected]>
---
drivers/block/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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




2020-06-29 20:57:28

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] loop: fix passing zero to 'PTR_ERR' warning

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