mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Tobias Nießen" <tobias.niessen@stud.uni-hannover.de>,
	gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-kernel@i4.cs.fau.de, Sabrina Gaube <sabrina-gaube@web.de>
Subject: Re: [PATCH 1/2] staging: rts5208: Rewrite redundant if statement to improve code style
Date: Wed, 26 Jun 2019 10:41:41 -0700	[thread overview]
Message-ID: <0ecf55be612b2ac5f40045796e54bb1ee758d3e4.camel@perches.com> (raw)
In-Reply-To: <20190626142857.30155-2-tobias.niessen@stud.uni-hannover.de>

On Wed, 2019-06-26 at 16:28 +0200, Tobias Nießen wrote:
> This commit uses the fact that
> 
>     if (a) {
>             if (b) {
>                     ...
>             }
>     }
> 
> can instead be written as
> 
>     if (a && b) {
>             ...
>     }
> 
> without any change in behavior, allowing to decrease the indentation
> of the contained code block and thus reducing the average line length.

unrelated and trivially:

> diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
[]
> @@ -4507,20 +4507,19 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
[]
> +			if (sd_lock_state &&
> +			    (sd_card->sd_lock_status & SD_LOCK_1BIT_MODE)) {
> +				sd_card->sd_lock_status |= (
> +					SD_UNLOCK_POW_ON | SD_SDR_RST);

This could go on a single line like the &= ~() equivalent below.
It hardly matters if it's > 80 chars.

> +				if (CHK_SD(sd_card)) {
> +					retval = reset_sd(chip);
> +					if (retval != STATUS_SUCCESS) {
> +						sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST);
> +						goto sd_execute_write_cmd_failed;
>  					}
> -
> -					sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST);
>  				}
> +
> +				sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST);
>  			}
>  		}
>  	}


  parent reply	other threads:[~2019-06-26 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 14:28 staging: rts5208: Two patches " Tobias Nießen
2019-06-26 14:28 ` [PATCH 1/2] staging: rts5208: Rewrite redundant if statement " Tobias Nießen
2019-06-26 14:56   ` Dan Carpenter
2019-06-30 14:12     ` Tobias Nießen
2019-07-17  8:48       ` Dan Carpenter
2019-06-26 17:41   ` Joe Perches [this message]
2019-06-26 14:28 ` [PATCH 2/2] staging: rts5208: Simplify boolean expression " Tobias Nießen

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=0ecf55be612b2ac5f40045796e54bb1ee758d3e4.camel@perches.com \
    --to=joe@perches.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@i4.cs.fau.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sabrina-gaube@web.de \
    --cc=tobias.niessen@stud.uni-hannover.de \
    /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®