Skip to content

Commit d41b26d

Browse files
Colin Ian Kingjgross1
authored andcommitted
xen/gntdev: remove redundant non-zero check on ret
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. [ [email protected]: limit scope of ret ] Addresses-Coverity: ("Logically dead code") Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Juergen Gross <[email protected]>
1 parent 348be43 commit d41b26d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/xen/gntdev.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ static const struct mmu_interval_notifier_ops gntdev_mmu_ops = {
506506
static int gntdev_open(struct inode *inode, struct file *flip)
507507
{
508508
struct gntdev_priv *priv;
509-
int ret = 0;
510509

511510
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
512511
if (!priv)
@@ -518,16 +517,12 @@ static int gntdev_open(struct inode *inode, struct file *flip)
518517
#ifdef CONFIG_XEN_GNTDEV_DMABUF
519518
priv->dmabuf_priv = gntdev_dmabuf_init(flip);
520519
if (IS_ERR(priv->dmabuf_priv)) {
521-
ret = PTR_ERR(priv->dmabuf_priv);
522-
kfree(priv);
523-
return ret;
524-
}
525-
#endif
520+
int ret = PTR_ERR(priv->dmabuf_priv);
526521

527-
if (ret) {
528522
kfree(priv);
529523
return ret;
530524
}
525+
#endif
531526

532527
flip->private_data = priv;
533528
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC

0 commit comments

Comments
 (0)