2017-11-28 15:17:06

by Vasyl Gomonovych

[permalink] [raw]
Subject: [PATCH] virtio-mmio: Use PTR_ERR_OR_ZERO()

Fix ptr_ret.cocci warnings:
drivers/virtio/virtio_mmio.c:653:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Vasyl Gomonovych <[email protected]>
---
drivers/virtio/virtio_mmio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 74dc7170fd35..8cffcb1706e1 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -650,10 +650,8 @@ static int vm_cmdline_set(const char *device,
pdev = platform_device_register_resndata(&vm_cmdline_parent,
"virtio-mmio", vm_cmdline_id++,
resources, ARRAY_SIZE(resources), NULL, 0);
- if (IS_ERR(pdev))
- return PTR_ERR(pdev);

- return 0;
+ return PTR_ERR_OR_ZERO(pdev);
}

static int vm_cmdline_get_device(struct device *dev, void *data)
--
1.9.1


From 1585320332070184107@xxx Tue Nov 28 14:28:03 +0000 2017
X-GM-THRID: 1585199168349334291
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread