linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: myungjoo.ham@samsung.com, sameo@linux.intel.com,
	lee.jones@linaro.org, patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] extcon: arizona: Eliminate dead error handling code
Date: Tue, 12 Nov 2013 14:30:31 +0000	[thread overview]
Message-ID: <20131112143031.GF6549@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <52817321.9040505@samsung.com>

On Tue, Nov 12, 2013 at 09:15:29AM +0900, Chanwoo Choi wrote:
> Hi CHarles,
> 
> On 11/08/2013 10:19 PM, Charles Keepax wrote:
> > As a small disclaimer I would personally prefer to not merge this patch.
> > I have added it based on previous code review of the other patches in
> > this chain.
> > 
> > arizona_hpdet_do_id currently can only return 0 or -EAGAIN making the
> > else if clause handling error codes redundant, this patch removes this
> > clause.
> > 
> > Whilst this clause is not currently hit removing it makes the code
> > fragile. It will not be obvious whilst editing arizona_hpdet_do_id that
> > you shouldn't add a return value other than 0 or -EAGAIN.
> > 
> > Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
> > ---
> >  drivers/extcon/extcon-arizona.c |    5 +++--
> >  1 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> > index 0d70bf6..2313b1e 100644
> > --- a/drivers/extcon/extcon-arizona.c
> > +++ b/drivers/extcon/extcon-arizona.c
> > @@ -476,6 +476,9 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
> >  	return val;
> >  }
> >  
> > +/* This function should only return 0 or -EAGAIN, if other return values are
> > + * added additional handling should be added in arizona_hpdet_irq.
> > + */
> 
> As Lee Jones commented, you should modify this comment of arizona_hpdet_do_id() and add
> the description of return value. Because arizoa_hpdet_do_id() has different meaning
> between -EAGAIN and other minus value.

I take it you are still very keen on applying a patch for this
dead code elimination? I really do feel it would be better to
leave this part of the code as it currently is, the extra safety
clearly outweights the cost of a redundant else if.

Thanks,
Charles

  reply	other threads:[~2013-11-12 14:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 13:19 [PATCH 1/4] extcon: arizona: Add defines for microphone detection levels Charles Keepax
2013-11-08 13:19 ` [PATCH 2/4] extcon: arizona: Fix reset of HPDET after race with removal Charles Keepax
2013-11-08 13:19 ` [PATCH 3/4] extcon: arizona: Fix race with microphone detection and removal Charles Keepax
2013-11-08 13:19 ` [PATCH 4/4] extcon: arizona: Eliminate dead error handling code Charles Keepax
2013-11-11  9:00   ` Lee Jones
2013-11-11  9:22     ` Charles Keepax
2013-11-12  0:15   ` Chanwoo Choi
2013-11-12 14:30     ` Charles Keepax [this message]
2013-11-13  2:10       ` Chanwoo Choi
2013-11-11 10:00 ` [PATCH 1/4] extcon: arizona: Add defines for microphone detection levels Chanwoo Choi
2013-11-11 10:53   ` Lee Jones
2013-11-11 10:57     ` Chanwoo Choi
2013-11-11 11:19       ` Lee Jones
2013-11-12  0:00         ` Chanwoo Choi
2013-11-11 11:06     ` Charles Keepax
2013-11-11 11:15       ` Lee Jones
2013-11-11 11:22         ` Chanwoo Choi
2013-11-11 11:26           ` Lee Jones
2013-11-12 14:25             ` Charles Keepax
2013-11-12 15:37               ` Lee Jones
2013-11-11 11:29 ` Lee Jones

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=20131112143031.GF6549@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=cw00.choi@samsung.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=sameo@linux.intel.com \
    /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).