[PATCH] staging: rts5208: remove unnecessary if

Daniel Baluta daniel.baluta at gmail.com
Mon Sep 22 22:34:52 EEST 2014


On Mon, Sep 22, 2014 at 7:10 PM, Roxana Blaj <roxanagabriela10 at gmail.com> wrote:
> This fixes the warning:
> WARNING: Too many leading tabs - consider code refactoring
>
> Additionally I fixed the warning:
> WARNING: line over 80 characters

This doesn't look to good.  By code refactoring I think one should use
some helper
functions.

> Signed-off-by: Roxana Blaj <roxanagabriela10 at gmail.com>
> ---
>  drivers/staging/rts5208/sd.c | 27 +++++++++++++++------------
>  1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
> index 21c3b3c..2a847d5 100644
> --- a/drivers/staging/rts5208/sd.c
> +++ b/drivers/staging/rts5208/sd.c
> @@ -4325,20 +4325,23 @@ int sd_execute_write_data(struct scsi_cmnd *srb, struct rtsx_chip *chip)
>                         sd_lock_state, sd_card->sd_lock_status);
>                 if (sd_lock_state ^ (sd_card->sd_lock_status & SD_LOCKED)) {
>                         sd_card->sd_lock_notify = 1;
> -                       if (sd_lock_state) {
> -                               if (sd_card->sd_lock_status & SD_LOCK_1BIT_MODE) {
> -                                       sd_card->sd_lock_status |= (
> -                                               SD_UNLOCK_POW_ON | SD_SDR_RST);
> -                                       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);
> -                                                       TRACE_GOTO(chip, SD_Execute_Write_Cmd_Failed);
> -                                               }
> +                       if (sd_lock_state && (
"(" should be moved on the next line.
> +                           sd_card->sd_lock_status & SD_LOCK_1BIT_MODE)) {
> +                               sd_card->sd_lock_status |= (
The same here.
> +                                       SD_UNLOCK_POW_ON | SD_SDR_RST);
> +                               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);
> +                                               TRACE_GOTO(chip,
> +                                                  SD_Execute_Write_Cmd_Failed);
>                                         }
> -
> -                                       sd_card->sd_lock_status &= ~(SD_UNLOCK_POW_ON | SD_SDR_RST);
>                                 }
> +
> +                               sd_card->sd_lock_status &= ~(
The same here together with ~.

> +                                       SD_UNLOCK_POW_ON | SD_SDR_RST);
>                         }
>                 }
>         }

I propose to drop this, it makes code harder to read.

You could have a look at this instead:

WARNING: Missing a blank line after declarations
#31: FILE: iio/frequency/ad9834.c:31:
+ unsigned long long freqreg = (u64) fout * (u64) (1 << AD9834_FREQ_BITS);
+ do_div(freqreg, mclk);

thanks,
Daniel.


More information about the firefly mailing list