Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] loop: fix passing zero to 'PTR_ERR' warning
@ 2020-06-24  8:48 Ding Xiang
  2020-06-29 20:54 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Ding Xiang @ 2020-06-24  8:48 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel

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

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] loop: fix passing zero to 'PTR_ERR' warning
  2020-06-24  8:48 [PATCH] loop: fix passing zero to 'PTR_ERR' warning Ding Xiang
@ 2020-06-29 20:54 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2020-06-29 20:54 UTC (permalink / raw)
  To: Ding Xiang; +Cc: axboe, linux-block, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  8:48 [PATCH] loop: fix passing zero to 'PTR_ERR' warning Ding Xiang
2020-06-29 20:54 ` Al Viro

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git