linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] xen/gntdev: remove redundant non-zero check on ret
@ 2019-11-11 12:20 Colin King
  2019-11-11 12:25 ` Jürgen Groß
  0 siblings, 1 reply; 5+ messages in thread
From: Colin King @ 2019-11-11 12:20 UTC (permalink / raw)
  To: Boris Ostrovsky, Juergen Gross, Stefano Stabellini, xen-devel
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The non-zero check on ret is always going to be false because
ret was initialized as zero and the only place it is set to
non-zero contains a return path before the non-zero check. Hence
the check is redundant and can be removed.

Addresses-Coverity: ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/xen/gntdev.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 10cc5e9e612a..07d80b176118 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -524,11 +524,6 @@ static int gntdev_open(struct inode *inode, struct file *flip)
 	}
 #endif
 
-	if (ret) {
-		kfree(priv);
-		return ret;
-	}
-
 	flip->private_data = priv;
 #ifdef CONFIG_XEN_GRANT_DMA_ALLOC
 	priv->dma_dev = gntdev_miscdev.this_device;
-- 
2.20.1


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

end of thread, other threads:[~2019-11-11 13:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 12:20 [PATCH][next] xen/gntdev: remove redundant non-zero check on ret Colin King
2019-11-11 12:25 ` Jürgen Groß
2019-11-11 12:31   ` Colin Ian King
2019-11-11 13:17     ` Jürgen Groß
2019-11-11 13:23       ` Colin Ian King

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