diff mbox

[U-Boot,02/12] mtd: cfi_flash: fix indentation

Message ID 1479257416-29389-3-git-send-email-andre.przywara@arm.com
State Accepted
Commit 58eab3287b0ea8e135617d2fb10e09d178d32c89
Delegated to: Tom Rini
Headers show

Commit Message

Andre Przywara Nov. 16, 2016, 12:50 a.m. UTC
The indentation is misleading here and suggests that the write command
will be only executed in the else clause.
It seems like this is not intended, so fix the indentation to avoid
both compiler warnings and puzzled readers.

Pointed out by GCC 6.2's -Wmisleading-indentation warning.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/mtd/cfi_flash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Roese Nov. 16, 2016, 11:26 a.m. UTC | #1
On 16.11.2016 01:50, Andre Przywara wrote:
> The indentation is misleading here and suggests that the write command
> will be only executed in the else clause.
> It seems like this is not intended, so fix the indentation to avoid
> both compiler warnings and puzzled readers.
>
> Pointed out by GCC 6.2's -Wmisleading-indentation warning.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
York Sun Nov. 16, 2016, 6:01 p.m. UTC | #2
On 11/15/2016 04:52 PM, Andre Przywara wrote:
> The indentation is misleading here and suggests that the write command
> will be only executed in the else clause.
> It seems like this is not intended, so fix the indentation to avoid
> both compiler warnings and puzzled readers.
>
> Pointed out by GCC 6.2's -Wmisleading-indentation warning.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  drivers/mtd/cfi_flash.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index 33c4a93..e036b88 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -1456,8 +1456,8 @@ static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot)
>  				cmd = FLASH_CMD_PROTECT_SET;
>  			else
>  				cmd = FLASH_CMD_PROTECT_CLEAR;
> -				flash_write_cmd(info, sector, 0,
> -					  FLASH_CMD_PROTECT);
> +
> +			flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT);
>  			flash_write_cmd(info, sector, 0, cmd);
>  			/* re-enable interrupts if necessary */
>  			if (flag)
>

The new GCC can find this? Nice.

York
Tom Rini Dec. 4, 2016, 11 p.m. UTC | #3
On Wed, Nov 16, 2016 at 12:50:06AM +0000, Andre Przywara wrote:

> The indentation is misleading here and suggests that the write command
> will be only executed in the else clause.
> It seems like this is not intended, so fix the indentation to avoid
> both compiler warnings and puzzled readers.
> 
> Pointed out by GCC 6.2's -Wmisleading-indentation warning.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 33c4a93..e036b88 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -1456,8 +1456,8 @@  static int cfi_protect_bugfix(flash_info_t *info, long sector, int prot)
 				cmd = FLASH_CMD_PROTECT_SET;
 			else
 				cmd = FLASH_CMD_PROTECT_CLEAR;
-				flash_write_cmd(info, sector, 0,
-					  FLASH_CMD_PROTECT);
+
+			flash_write_cmd(info, sector, 0, FLASH_CMD_PROTECT);
 			flash_write_cmd(info, sector, 0, cmd);
 			/* re-enable interrupts if necessary */
 			if (flag)