From: YueHaibing <yuehaibing@huawei.com>
To: <axboe@kernel.dk>, <maco@android.com>
Cc: <linux-block@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH] loop: Fix passing zero to 'PTR_ERR' warning
Date: Thu, 12 Nov 2020 22:52:33 +0800 [thread overview]
Message-ID: <20201112145233.53060-1-yuehaibing@huawei.com> (raw)
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 --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);
--
2.17.1
next reply other threads:[~2020-11-12 14:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 14:52 YueHaibing [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-06-24 8:48 [PATCH] loop: fix passing zero to 'PTR_ERR' warning Ding Xiang
2020-06-29 20:54 ` Al Viro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112145233.53060-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).