Re: [PATCH][next] xen/gntdev: remove redundant non-zero check on ret

From: Colin Ian King
Date: Mon Nov 11 2019 - 07:31:35 EST


On 11/11/2019 12:25, JÃrgen Groà wrote:
> On 11.11.19 13:20, Colin King wrote:
>> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>>
>> 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
>
>
> Juergen
>
>>
>> Addresses-Coverity: ("Logically dead code")
>> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>> ---
>> Â 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;
>>
>