All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: isdn@linux-pingi.de, Networking <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] isdn: hfc_{pci,sx}: Avoid empty body if statements and use proper register accessors
Date: Wed, 17 Oct 2018 20:34:35 -0700	[thread overview]
Message-ID: <20181018033435.GA2734@flashbox> (raw)
In-Reply-To: <CAK7LNARjwZr2NPNE9aGnzQv-uUWjf1=A+kX3pjALqYfsWORv5g@mail.gmail.com>

On Thu, Oct 18, 2018 at 12:23:37PM +0900, Masahiro Yamada wrote:
> Hi Nathan,
> 
> On Thu, Oct 18, 2018 at 3:09 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > drivers/isdn/hisax/hfc_pci.c:131:34: error: if statement has empty body
> > [-Werror,-Wempty-body]
> >         if (Read_hfc(cs, HFCPCI_INT_S1));
> >                                         ^
> > drivers/isdn/hisax/hfc_pci.c:131:34: note: put the semicolon on a
> > separate line to silence this warning
> >
> > Use the format found in drivers/isdn/hardware/mISDN/hfcpci.c of casting
> > the return of Read_hfc to void, instead of using an empty if statement.
> >
> > While we're at it, Masahiro Yamada pointed out that {Read,Write}_hfc
> > should be using a standard access method in hfc_pci.h. Use the one found
> > in drivers/isdn/hardware/mISDN/hfc_pci.h.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/66
> > Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/isdn/hisax/hfc_pci.c | 6 +++---
> >  drivers/isdn/hisax/hfc_pci.h | 4 ++--
> >  drivers/isdn/hisax/hfc_sx.c  | 6 +++---
> >  3 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
> > index 8e5b03161b2f..a63b9155b697 100644
> > --- a/drivers/isdn/hisax/hfc_pci.c
> > +++ b/drivers/isdn/hisax/hfc_pci.c
> > @@ -128,7 +128,7 @@ reset_hfcpci(struct IsdnCardState *cs)
> >         Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
> >
> >         /* Clear already pending ints */
> > -       if (Read_hfc(cs, HFCPCI_INT_S1));
> > +       (void) Read_hfc(cs, HFCPCI_INT_S1);
> 
> 
> 
> Why is this '(void)' necessary?
> 

It's not. I never tested without it since last time I tried to remove
the if statement, GCC complained at me but that was before the readb
change like you suggested.

I will go ahead and send a v2 with that cleaned up.

> I see no warning without it.
> 
> 
> 
> -- 
> Best Regards
> Masahiro Yamada

Thanks for the review!
Nathan

  reply	other threads:[~2018-10-18  3:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 18:06 [PATCH] isdn: hfc_{pci,sx}: Avoid empty body if statements and use proper register accessors Nathan Chancellor
2018-10-18  3:23 ` Masahiro Yamada
2018-10-18  3:34   ` Nathan Chancellor [this message]
2018-10-18  3:49 ` [PATCH v2] isdn: hfc_{pci,sx}: Avoid empty body if statements Nathan Chancellor
2018-10-18 22:42   ` David Miller
2018-10-19  0:21     ` Nathan Chancellor
2018-10-19  0:23       ` David Miller
2018-10-19  0:42         ` Nathan Chancellor
2018-10-19  0:50           ` David Miller
2018-10-19  1:01             ` Nathan Chancellor
2018-10-19  1:11   ` [PATCH v3] " Nathan Chancellor
2018-10-23  2:25     ` David Miller

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=20181018033435.GA2734@flashbox \
    --to=natechancellor@gmail.com \
    --cc=isdn@linux-pingi.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.