Re: [V9fs-developer] [Patch] Dead code in fs/9p/vfs_inode.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The comment is longer than the 10 bytes we save :)

I like defensive programming, but I am not sure it is required in this
case. The function is 30 lines long and it is going to be pretty hard
to make a mistake when it is modified.

I am for removing the if.

Thanks,
   Lucho

On 6/29/06, Jan Engelhardt <[email protected]> wrote:
>> --- linux-2.6.17-git11/fs/9p/vfs_inode.c.orig   2006-06-29
>> 00:50:53.000000000 +0200
>> +++ linux-2.6.17-git11/fs/9p/vfs_inode.c        2006-06-29
>> 00:51:11.000000000 +0200
>> @@ -386,9 +386,6 @@ v9fs_inode_from_fid(struct v9fs_session_
>>
>> error:
>>        kfree(fcall);
>> -       if (ret)
>> -               iput(ret);
>> -
>>       return ERR_PTR(err);
>> }
>
> What about when someone changes the code and does have ret != NULL here?
> This seems like reasonable defensive programming to me.


How about a comment:

        kfree(fcall);

        /* Currently commented out because ret is NULL in any case.
        It is here to remind someone should this condition become
        false in future. */
        /* if(ret != NULL) */
                iput(ret);


Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux