mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Latchesar Ionkov" <lionkov@gmail.com>
To: "Jan Engelhardt" <jengelh@linux01.gwdg.de>
Cc: "Russ Cox" <rsc@swtch.com>, "Eric Sesterhenn" <snakebyte@gmx.de>,
	linux-kernel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net
Subject: Re: [V9fs-developer] [Patch] Dead code in fs/9p/vfs_inode.c
Date: Thu, 29 Jun 2006 09:16:27 -0600	[thread overview]
Message-ID: <f158dc670606290816p4a7add09mf6742d632ec12d28@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0606291300010.30453@yvahk01.tjqt.qr>

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 <jengelh@linux01.gwdg.de> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  reply	other threads:[~2006-06-29 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28 22:52 Eric Sesterhenn
2006-06-28 22:55 ` [V9fs-developer] " Russ Cox
2006-06-28 23:16   ` Eric Sesterhenn / Snakebyte
2006-06-28 23:24     ` Russ Cox
2006-06-28 23:41       ` Eric Sesterhenn / Snakebyte
2006-06-29  3:58     ` David Leimbach
2006-06-29  5:27   ` Pekka Enberg
2006-06-29 11:01   ` Jan Engelhardt
2006-06-29 15:16     ` Latchesar Ionkov [this message]
2006-06-30 13:44       ` Jan Engelhardt
2006-06-30 14:12         ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f158dc670606290816p4a7add09mf6742d632ec12d28@mail.gmail.com \
    --to=lionkov@gmail.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rsc@swtch.com \
    --cc=snakebyte@gmx.de \
    --cc=v9fs-developer@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®