kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: der.herr@hofr.at (Nicholas Mc Guire)
To: kernelnewbies@lists.kernelnewbies.org
Subject: if/else block default coding style question
Date: Sat, 8 Oct 2016 15:23:49 +0000	[thread overview]
Message-ID: <20161008152349.GA1823@osadl.at> (raw)
In-Reply-To: <alpine.LFD.2.20.1610081107180.11797@localhost.localdomain>

On Sat, Oct 08, 2016 at 11:10:10AM -0400, Robert P. J. Day wrote:
> On Sat, 8 Oct 2016, Valdis.Kletnieks at vt.edu wrote:
> 
> > On Sat, 08 Oct 2016 10:40:37 -0000, Nicholas Mc Guire said:
> >
> > >    } else if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) {
> > >            rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte);
> > >    } else {
> > >            rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte);
> > >    }
> >
> > That *does* smell like a bug.  If nothing else, the last 'else if'
> > can be removed.  Most likely case: somebody cut-n-pasted that last
> > section in and failed to change it to a proper 'default' value and
> > the code falls through to that one rarely enough that nobody has
> > noticed.
> 
>   if that's the behaviour the developer actually wants, then yes, it's
> messy. but i would be very careful just simplifying it wholesale,
> since it also smacks of a typo where one copy-and-pasted to add the
> default case, then forgot to tweak it to be different.
> 
>   rather than "fixing" it, i would bring it to the attention of the
> maintainer, and ask him or her to resolve it.
>
sure - no point in fixing code one does not understand.

if at all I send "fixes" out as RFCs if it seems like an obvious
case - and in all other cases a notification/questions are sent
but no patch.

thx!
hofrat
 

  reply	other threads:[~2016-10-08 15:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-08 10:40 if/else block default coding style question Nicholas Mc Guire
2016-10-08 14:58 ` Valdis.Kletnieks at vt.edu
2016-10-08 15:10   ` Robert P. J. Day
2016-10-08 15:23     ` Nicholas Mc Guire [this message]
2016-10-08 15:19   ` Nicholas Mc Guire
2016-10-08 19:40     ` Valdis.Kletnieks at vt.edu

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=20161008152349.GA1823@osadl.at \
    --to=der.herr@hofr.at \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /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;
as well as URLs for NNTP newsgroup(s).