All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Keerthi Reddy <keerthigd4990@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [PATCH] Staging: Dgnc: Remove unnecessary comments around control statements.
Date: Mon, 18 Sep 2017 11:43:44 +0200	[thread overview]
Message-ID: <20170918094344.GE9461@kroah.com> (raw)
In-Reply-To: <20170915154434.GA15633@manoharreddy>

On Fri, Sep 15, 2017 at 09:14:34PM +0530, Keerthi Reddy wrote:
> Remove Un necessary comments around control statements

"comments"?  That's not what this patch does at all :(

> 
> Checked with checkpatch.pl.
> 
> With this changes, I am also able to compile the code.

That should always be the case, no need to ever say that :)

> 
> Signed-off-by: Keerthi Reddy <keerthigd4990@gmail.com>
> ---
>  drivers/staging/dgnc/dgnc_cls.c | 16 ++++++++--------
>  drivers/staging/dgnc/dgnc_neo.c | 22 +++++++++++-----------
>  drivers/staging/dgnc/dgnc_tty.c | 34 +++++++++++++++++-----------------
>  3 files changed, 36 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
> index 9639035..870ae3d 100644
> --- a/drivers/staging/dgnc/dgnc_cls.c
> +++ b/drivers/staging/dgnc/dgnc_cls.c
> @@ -706,7 +706,7 @@ static void cls_param(struct tty_struct *tty)
>  		 * unit is NOT open
>  		 */
>  		if (!(ch->ch_tun.un_flags & UN_ISOPEN) &&
> -		    (un->un_type == DGNC_PRINT))
> +		    un->un_type == DGNC_PRINT)
>  			baud = C_BAUD(ch->ch_pun.un_tty) & 0xff;
>  		else
>  			baud = C_BAUD(ch->ch_tun.un_tty) & 0xff;
> @@ -719,8 +719,8 @@ static void cls_param(struct tty_struct *tty)
>  
>  		jindex = baud;
>  
> -		if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) &&
> -		    (jindex < 16)) {
> +		if (iindex >= 0 && iindex < 4 && jindex >= 0 &&
> +		    jindex < 16) {

This is harder to read now, don't you think?  And yes, it might be
"correct", but it is good to keep () around things like this so you
don't have to go look up the order-of-operations to ensure that the
developer got it correct.

thanks,

greg k-h


  reply	other threads:[~2017-09-18  9:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 15:44 [PATCH] Staging: Dgnc: Remove unnecessary comments around control statements Keerthi Reddy
2017-09-18  9:43 ` Greg KH [this message]
2017-09-18 10:40   ` Keerthi Reddy

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=20170918094344.GE9461@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=keerthigd4990@gmail.com \
    --cc=outreachy-kernel@googlegroups.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.