Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445751

[PATCH] virtio-balloon: Delete an unnecessary check before the function call "iput"

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH] virtio-balloon: Delete an unnecessary check before the function call "iput"
Date 2016-07-18 21:30 +0200
Message-ID <rWmoO-1Wa-9@gated-at.bofh.it> (permalink)
References (12 earlier) <mSsDN-4wa-59@gated-at.bofh.it> <mSsDN-4wa-61@gated-at.bofh.it> <mSsDN-4wa-63@gated-at.bofh.it> <mSsDN-4wa-65@gated-at.bofh.it> <mSsDN-4wa-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 18 Jul 2016 21:17:18 +0200

The iput() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/virtio/virtio_balloon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 888d5f8..81f7d6c 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -611,8 +611,7 @@ static void virtballoon_remove(struct virtio_device *vdev)
 	cancel_work_sync(&vb->update_balloon_stats_work);
 
 	remove_common(vb);
-	if (vb->vb_dev_info.inode)
-		iput(vb->vb_dev_info.inode);
+	iput(vb->vb_dev_info.inode);
 	kfree(vb);
 }
 
-- 
2.9.2

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] virtio-balloon: Delete an unnecessary check before the  function call "iput" SF Markus Elfring <elfring@users.sourceforge.net> - 2016-07-18 21:30 +0200

csiph-web