xen/gntdev: remove redundant non-zero check on ret
Subsystems (2)
PATCH 1/1 xen/gntdev: remove redundant non-zero check on ret
From: Colin Ian King <[email protected]>
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")
--- drivers/xen/gntdev.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/xen/gntdev.c +0 -5
@@ -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;
Signature · 1 line
2.20.1
Jürgen Groß
maintainerQuoted 6 lines · Colin King
From: Colin Ian King <[email protected]>
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.
Which version did you patch against? In current master the above statement is not true.
Juergen
Quoted 24 lines
Addresses-Coverity: ("Logically dead code")
Signed-off-by Colin Ian King <[email protected]>--- drivers/xen/gntdev.c | 5 ----- 1 file changed, 5 deletions(-)drivers/xen/gntdev.c +0
-5@@ -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;
Quoted 10 lines · Jürgen Groß
Quoted 6 lines · Colin King
From: Colin Ian King <[email protected]>
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.
Which version did you patch against? In current master the above statement is not true.
against today's linux-next
Colin
Quoted 29 lines
Juergen
Quoted 24 lines
Addresses-Coverity: ("Logically dead code")
Signed-off-by Colin Ian King <[email protected]>---
drivers/xen/gntdev.c| 5 -----1 file changed, 5 deletions(-)drivers/xen/gntdev.c +0
-4@@ -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;
Jürgen Groß
maintainerQuoted 9 lines · Colin Ian King
Quoted 8 lines · Jürgen Groß
Quoted 6 lines · Colin King
From: Colin Ian King <[email protected]>
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.
Quoted 4 lines
Quoted 2 lines
Which version did you patch against? In current master the above statement is not true.
against today's linux-next
Ah, okay, this is likely the result of the recent mm-notifier patch series. I'll put this patch on hold until the recent patches have hit master.
Juergen
Quoted 10 lines · Jürgen Groß
Quoted 9 lines · Colin Ian King
Quoted 8 lines · Jürgen Groß
Quoted 6 lines · Colin King
From: Colin Ian King <[email protected]>
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Which version did you patch against? In current master the above statement is not true.
against today's linux-next
Ah, okay, this is likely the result of the recent mm-notifier patch series. I'll put this patch on hold until the recent patches have hit master.
Cool, thanks!
Quoted 3 lines
Juergen