All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e1000/base: Add missing braces to the 'if' statements
@ 2016-06-23  9:25 Markos Chandras
  2016-06-23 10:26 ` Anupam Kapoor
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Markos Chandras @ 2016-06-23  9:25 UTC (permalink / raw)
  To: dev; +Cc: Markos Chandras

Add the missing braces to the 'if' statements to fix the misleading
identation. This also fixes the following build errors when building
with gcc >= 6:

drivers/net/e1000/base/e1000_phy.c:4156:2:
error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (locked)
^~

drivers/net/e1000/base/e1000_phy.c:4158:3:
note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
if (!ready)
^~

drivers/net/e1000/base/e1000_phy.c: In function 'e1000_write_phy_reg_mphy':
drivers/net/e1000/base/e1000_phy.c:4221:2:
error: this 'if' clause does not guard... [-Werror=misleading-indentation]
if (locked)
^~

drivers/net/e1000/base/e1000_phy.c:4223:3:
note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
if (!ready)
^~

Signed-off-by: Markos Chandras <mchandras@suse.de>
---
 drivers/net/e1000/base/e1000_phy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/base/e1000_phy.c b/drivers/net/e1000/base/e1000_phy.c
index d43b7ce..33f478b 100644
--- a/drivers/net/e1000/base/e1000_phy.c
+++ b/drivers/net/e1000/base/e1000_phy.c
@@ -4153,12 +4153,13 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 *data)
 	*data = E1000_READ_REG(hw, E1000_MPHY_DATA);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked)
+	if (locked) {
 		ready = e1000_is_mphy_ready(hw);
 		if (!ready)
 			return -E1000_ERR_PHY;
 		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
 				E1000_MPHY_DIS_ACCESS);
+	}
 
 	return E1000_SUCCESS;
 }
@@ -4218,12 +4219,13 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw, u32 address, u32 data,
 	E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
 
 	/* Disable access to mPHY if it was originally disabled */
-	if (locked)
+	if (locked) {
 		ready = e1000_is_mphy_ready(hw);
 		if (!ready)
 			return -E1000_ERR_PHY;
 		E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
 				E1000_MPHY_DIS_ACCESS);
+	}
 
 	return E1000_SUCCESS;
 }
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-23  9:25 [PATCH] e1000/base: Add missing braces to the 'if' statements Markos Chandras
@ 2016-06-23 10:26 ` Anupam Kapoor
  2016-06-23 10:34   ` Markos Chandras
  2016-06-24  0:43 ` Lu, Wenzhuo
  2016-06-27 14:39 ` Bruce Richardson
  2 siblings, 1 reply; 10+ messages in thread
From: Anupam Kapoor @ 2016-06-23 10:26 UTC (permalink / raw)
  To: Markos Chandras; +Cc: dev

hi markos,

please see : cba50f6be0db9efdf694dcf4bce4a6945a275182, which should already
fix this.

--
thanks
anupam


On Thu, Jun 23, 2016 at 2:55 PM, Markos Chandras <mchandras@suse.de> wrote:

> Add the missing braces to the 'if' statements to fix the misleading
> identation. This also fixes the following build errors when building
> with gcc >= 6:
>
> drivers/net/e1000/base/e1000_phy.c:4156:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (locked)
> ^~
>
> drivers/net/e1000/base/e1000_phy.c:4158:3:
> note: ...this statement, but the latter is misleadingly indented as if it
> is guarded by the 'if'
> if (!ready)
> ^~
>
> drivers/net/e1000/base/e1000_phy.c: In function 'e1000_write_phy_reg_mphy':
> drivers/net/e1000/base/e1000_phy.c:4221:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (locked)
> ^~
>
> drivers/net/e1000/base/e1000_phy.c:4223:3:
> note: ...this statement, but the latter is misleadingly indented as if it
> is guarded by the 'if'
> if (!ready)
> ^~
>
> Signed-off-by: Markos Chandras <mchandras@suse.de>
> ---
>  drivers/net/e1000/base/e1000_phy.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/e1000/base/e1000_phy.c
> b/drivers/net/e1000/base/e1000_phy.c
> index d43b7ce..33f478b 100644
> --- a/drivers/net/e1000/base/e1000_phy.c
> +++ b/drivers/net/e1000/base/e1000_phy.c
> @@ -4153,12 +4153,13 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw *hw,
> u32 address, u32 *data)
>         *data = E1000_READ_REG(hw, E1000_MPHY_DATA);
>
>         /* Disable access to mPHY if it was originally disabled */
> -       if (locked)
> +       if (locked) {
>                 ready = e1000_is_mphy_ready(hw);
>                 if (!ready)
>                         return -E1000_ERR_PHY;
>                 E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
>                                 E1000_MPHY_DIS_ACCESS);
> +       }
>
>         return E1000_SUCCESS;
>  }
> @@ -4218,12 +4219,13 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw *hw,
> u32 address, u32 data,
>         E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
>
>         /* Disable access to mPHY if it was originally disabled */
> -       if (locked)
> +       if (locked) {
>                 ready = e1000_is_mphy_ready(hw);
>                 if (!ready)
>                         return -E1000_ERR_PHY;
>                 E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
>                                 E1000_MPHY_DIS_ACCESS);
> +       }
>
>         return E1000_SUCCESS;
>  }
> --
> 2.8.4
>
>


-- 
In the beginning was the lambda, and the lambda was with Emacs, and Emacs
was the lambda.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-23 10:26 ` Anupam Kapoor
@ 2016-06-23 10:34   ` Markos Chandras
  2016-06-23 10:46     ` Anupam Kapoor
  0 siblings, 1 reply; 10+ messages in thread
From: Markos Chandras @ 2016-06-23 10:34 UTC (permalink / raw)
  To: Anupam Kapoor; +Cc: dev

Hi Anupam,

I have seen your commit, but my patch fixes a different file (although 
the fix is similar).

Am I missing something?

On 2016-06-23 11:26, Anupam Kapoor wrote:
> hi markos,
> 
> please see : cba50f6be0db9efdf694dcf4bce4a6945a275182, which should 
> already
> fix this.
> 
> --
> thanks
> anupam
> 
> 
> On Thu, Jun 23, 2016 at 2:55 PM, Markos Chandras <mchandras@suse.de> 
> wrote:
> 
>> Add the missing braces to the 'if' statements to fix the misleading
>> identation. This also fixes the following build errors when building
>> with gcc >= 6:
>> 
>> drivers/net/e1000/base/e1000_phy.c:4156:2:
>> error: this 'if' clause does not guard... 
>> [-Werror=misleading-indentation]
>> if (locked)
>> ^~
>> 
>> drivers/net/e1000/base/e1000_phy.c:4158:3:
>> note: ...this statement, but the latter is misleadingly indented as if 
>> it
>> is guarded by the 'if'
>> if (!ready)
>> ^~
>> 
>> drivers/net/e1000/base/e1000_phy.c: In function 
>> 'e1000_write_phy_reg_mphy':
>> drivers/net/e1000/base/e1000_phy.c:4221:2:
>> error: this 'if' clause does not guard... 
>> [-Werror=misleading-indentation]
>> if (locked)
>> ^~
>> 
>> drivers/net/e1000/base/e1000_phy.c:4223:3:
>> note: ...this statement, but the latter is misleadingly indented as if 
>> it
>> is guarded by the 'if'
>> if (!ready)
>> ^~
>> 
>> Signed-off-by: Markos Chandras <mchandras@suse.de>
>> ---
>>  drivers/net/e1000/base/e1000_phy.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/net/e1000/base/e1000_phy.c
>> b/drivers/net/e1000/base/e1000_phy.c
>> index d43b7ce..33f478b 100644
>> --- a/drivers/net/e1000/base/e1000_phy.c
>> +++ b/drivers/net/e1000/base/e1000_phy.c
>> @@ -4153,12 +4153,13 @@ s32 e1000_read_phy_reg_mphy(struct e1000_hw 
>> *hw,
>> u32 address, u32 *data)
>>         *data = E1000_READ_REG(hw, E1000_MPHY_DATA);
>> 
>>         /* Disable access to mPHY if it was originally disabled */
>> -       if (locked)
>> +       if (locked) {
>>                 ready = e1000_is_mphy_ready(hw);
>>                 if (!ready)
>>                         return -E1000_ERR_PHY;
>>                 E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
>>                                 E1000_MPHY_DIS_ACCESS);
>> +       }
>> 
>>         return E1000_SUCCESS;
>>  }
>> @@ -4218,12 +4219,13 @@ s32 e1000_write_phy_reg_mphy(struct e1000_hw 
>> *hw,
>> u32 address, u32 data,
>>         E1000_WRITE_REG(hw, E1000_MPHY_DATA, data);
>> 
>>         /* Disable access to mPHY if it was originally disabled */
>> -       if (locked)
>> +       if (locked) {
>>                 ready = e1000_is_mphy_ready(hw);
>>                 if (!ready)
>>                         return -E1000_ERR_PHY;
>>                 E1000_WRITE_REG(hw, E1000_MPHY_ADDR_CTRL,
>>                                 E1000_MPHY_DIS_ACCESS);
>> +       }
>> 
>>         return E1000_SUCCESS;
>>  }
>> --
>> 2.8.4
>> 
>> 

-- 
SUSE LINUX GmbH | GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg) Maxfeldstr. 5, D-90409, Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-23 10:34   ` Markos Chandras
@ 2016-06-23 10:46     ` Anupam Kapoor
  0 siblings, 0 replies; 10+ messages in thread
From: Anupam Kapoor @ 2016-06-23 10:46 UTC (permalink / raw)
  To: Markos Chandras; +Cc: dev

On Thu, Jun 23, 2016 at 4:04 PM, Markos Chandras <mchandras@suse.de> wrote:

> I have seen your commit, but my patch fixes a different file (although the
> fix is similar).
>
> Am I missing something?
>

​ah no. my bad. sorry about that.

​--
thanks
anupam​

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-23  9:25 [PATCH] e1000/base: Add missing braces to the 'if' statements Markos Chandras
  2016-06-23 10:26 ` Anupam Kapoor
@ 2016-06-24  0:43 ` Lu, Wenzhuo
  2016-06-24  7:12   ` Thomas Monjalon
  2016-06-27 14:39 ` Bruce Richardson
  2 siblings, 1 reply; 10+ messages in thread
From: Lu, Wenzhuo @ 2016-06-24  0:43 UTC (permalink / raw)
  To: Markos Chandras, dev

Hi Markos,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Markos Chandras
> Sent: Thursday, June 23, 2016 5:26 PM
> To: dev@dpdk.org
> Cc: Markos Chandras
> Subject: [dpdk-dev] [PATCH] e1000/base: Add missing braces to the 'if'
> statements
> 
> Add the missing braces to the 'if' statements to fix the misleading identation.
> This also fixes the following build errors when building with gcc >= 6:
> 
> drivers/net/e1000/base/e1000_phy.c:4156:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation] if
> (locked) ^~
> 
> drivers/net/e1000/base/e1000_phy.c:4158:3:
> note: ...this statement, but the latter is misleadingly indented as if it is guarded
> by the 'if'
> if (!ready)
> ^~
> 
> drivers/net/e1000/base/e1000_phy.c: In function 'e1000_write_phy_reg_mphy':
> drivers/net/e1000/base/e1000_phy.c:4221:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation] if
> (locked) ^~
> 
> drivers/net/e1000/base/e1000_phy.c:4223:3:
> note: ...this statement, but the latter is misleadingly indented as if it is guarded
> by the 'if'
> if (!ready)
> ^~
> 
> Signed-off-by: Markos Chandras <mchandras@suse.de>
Thanks for this patch. But normally the code in the base directory is synced from the kernel driver. So we don't change it if there's no critical issue. It's easy for us to maintain it. Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-24  0:43 ` Lu, Wenzhuo
@ 2016-06-24  7:12   ` Thomas Monjalon
  2016-06-24  8:31     ` Lu, Wenzhuo
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Monjalon @ 2016-06-24  7:12 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: dev, Markos Chandras

2016-06-24 00:43, Lu, Wenzhuo:
> Thanks for this patch. But normally the code in the base directory is synced from the kernel driver. So we don't change it if there's no critical issue. It's easy for us to maintain it. Thanks.

I think a build error is critical enough.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-24  7:12   ` Thomas Monjalon
@ 2016-06-24  8:31     ` Lu, Wenzhuo
  2016-06-27 15:05       ` Bruce Richardson
  0 siblings, 1 reply; 10+ messages in thread
From: Lu, Wenzhuo @ 2016-06-24  8:31 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Markos Chandras

Hi Thomas, Markos,


> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Friday, June 24, 2016 3:13 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org; Markos Chandras
> Subject: Re: [dpdk-dev] [PATCH] e1000/base: Add missing braces to the 'if'
> statements
> 
> 2016-06-24 00:43, Lu, Wenzhuo:
> > Thanks for this patch. But normally the code in the base directory is synced
> from the kernel driver. So we don't change it if there's no critical issue. It's easy
> for us to maintain it. Thanks.
> 
> I think a build error is critical enough.
OK. The change itself looks fine to me.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-23  9:25 [PATCH] e1000/base: Add missing braces to the 'if' statements Markos Chandras
  2016-06-23 10:26 ` Anupam Kapoor
  2016-06-24  0:43 ` Lu, Wenzhuo
@ 2016-06-27 14:39 ` Bruce Richardson
  2016-06-27 15:47   ` Markos Chandras
  2 siblings, 1 reply; 10+ messages in thread
From: Bruce Richardson @ 2016-06-27 14:39 UTC (permalink / raw)
  To: Markos Chandras; +Cc: dev

On Thu, Jun 23, 2016 at 10:25:52AM +0100, Markos Chandras wrote:
> Add the missing braces to the 'if' statements to fix the misleading
> identation. This also fixes the following build errors when building
> with gcc >= 6:
> 
> drivers/net/e1000/base/e1000_phy.c:4156:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (locked)
> ^~
> 
> drivers/net/e1000/base/e1000_phy.c:4158:3:
> note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
> if (!ready)
> ^~
> 
> drivers/net/e1000/base/e1000_phy.c: In function 'e1000_write_phy_reg_mphy':
> drivers/net/e1000/base/e1000_phy.c:4221:2:
> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
> if (locked)
> ^~
> 
> drivers/net/e1000/base/e1000_phy.c:4223:3:
> note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
> if (!ready)
> ^~
> 
> Signed-off-by: Markos Chandras <mchandras@suse.de>
> ---

Any particular compiler flags needed to reproduce this issue? Compiling with
gcc6.1 I don't see any errors reported.

/Bruce

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-24  8:31     ` Lu, Wenzhuo
@ 2016-06-27 15:05       ` Bruce Richardson
  0 siblings, 0 replies; 10+ messages in thread
From: Bruce Richardson @ 2016-06-27 15:05 UTC (permalink / raw)
  To: Lu, Wenzhuo; +Cc: Thomas Monjalon, dev, Markos Chandras

On Fri, Jun 24, 2016 at 08:31:05AM +0000, Lu, Wenzhuo wrote:
> Hi Thomas, Markos,
> 
> 
> > -----Original Message-----
> > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> > Sent: Friday, June 24, 2016 3:13 PM
> > To: Lu, Wenzhuo
> > Cc: dev@dpdk.org; Markos Chandras
> > Subject: Re: [dpdk-dev] [PATCH] e1000/base: Add missing braces to the 'if'
> > statements
> > 
> > 2016-06-24 00:43, Lu, Wenzhuo:
> > > Thanks for this patch. But normally the code in the base directory is synced
> > from the kernel driver. So we don't change it if there's no critical issue. It's easy
> > for us to maintain it. Thanks.
> > 
> > I think a build error is critical enough.
> OK. The change itself looks fine to me.

Applied to dpdk-next-net/rel_16_07

/Bruce

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] e1000/base: Add missing braces to the 'if' statements
  2016-06-27 14:39 ` Bruce Richardson
@ 2016-06-27 15:47   ` Markos Chandras
  0 siblings, 0 replies; 10+ messages in thread
From: Markos Chandras @ 2016-06-27 15:47 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

Hi Bruce,

On 06/27/2016 03:39 PM, Bruce Richardson wrote:
> On Thu, Jun 23, 2016 at 10:25:52AM +0100, Markos Chandras wrote:
>> Add the missing braces to the 'if' statements to fix the misleading
>> identation. This also fixes the following build errors when building
>> with gcc >= 6:
>>
>> drivers/net/e1000/base/e1000_phy.c:4156:2:
>> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
>> if (locked)
>> ^~
>>
>> drivers/net/e1000/base/e1000_phy.c:4158:3:
>> note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
>> if (!ready)
>> ^~
>>
>> drivers/net/e1000/base/e1000_phy.c: In function 'e1000_write_phy_reg_mphy':
>> drivers/net/e1000/base/e1000_phy.c:4221:2:
>> error: this 'if' clause does not guard... [-Werror=misleading-indentation]
>> if (locked)
>> ^~
>>
>> drivers/net/e1000/base/e1000_phy.c:4223:3:
>> note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
>> if (!ready)
>> ^~
>>
>> Signed-off-by: Markos Chandras <mchandras@suse.de>
>> ---
> 
> Any particular compiler flags needed to reproduce this issue? Compiling with
> gcc6.1 I don't see any errors reported.
> 
> /Bruce
> 

I only have the log from the 2.2.0 + gcc-6 build so here is the line

gcc -Wp,-MD,./.e1000_phy.o.d.tmp -m64 -pthread -fPIC  -march=core2
-DRTE_MACHINE_CPUFLAG_SSE -DRTE_MACHINE_CPUFLAG_SSE2
-DRTE_MACHINE_CPUFLAG_SSE3 -DRTE_MACHINE_CPUFLAG_SSSE3
-DRTE_COMPILE_TIME_CPUFLAGS
=RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSSE3
-I/home/abuild/rpmbuild/BUILD/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include
-include
/home/abuild/rpmbuild/BUILD/dpdk-2.2.0/x86_64-native-linuxapp-gcc/include/rte_config.h
-O3 -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -Wold-style-definition -Wpointer-arith
-Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonli
teral -Wformat-security -Wundef -Wwrite-strings -Wno-uninitialized
-Wno-unused-parameter -Wno-unused-variable -fmessage-length=0
-grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2
-fstack-protector-strong -funw
ind-tables -fasynchronous-unwind-tables -g -Wformat -fPIC
-Wno-error=array-bounds -o e1000_phy.o -c
/home/abuild/rpmbuild/BUILD/dpdk-2.2.0/drivers/net/e1000/base/e1000_phy.c

But next time I will make sure I will add the command line that causes
the problem in the comment section of the patch as well.

-- 
markos

SUSE LINUX GmbH | GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg) Maxfeldstr. 5, D-90409, Nürnberg

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-06-27 15:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-23  9:25 [PATCH] e1000/base: Add missing braces to the 'if' statements Markos Chandras
2016-06-23 10:26 ` Anupam Kapoor
2016-06-23 10:34   ` Markos Chandras
2016-06-23 10:46     ` Anupam Kapoor
2016-06-24  0:43 ` Lu, Wenzhuo
2016-06-24  7:12   ` Thomas Monjalon
2016-06-24  8:31     ` Lu, Wenzhuo
2016-06-27 15:05       ` Bruce Richardson
2016-06-27 14:39 ` Bruce Richardson
2016-06-27 15:47   ` Markos Chandras

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.