[dpdk-dev,2/7] net/ixgbe/base: remove a compiler warning
Checks
Commit Message
This patch fixes a compiler warning.
Signed-off-by: Wei Dai <wei.dai@intel.com>
---
drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 1/10/2017 3:45 PM, Wei Dai wrote:
> This patch fixes a compiler warning.
I guess compiler warning is because of "mac->led_link_act = i;", since
led_link_act is 8bits..
But can you please add the compile warning here, to make it more clear
to understand what is the issue.
>
> Signed-off-by: Wei Dai <wei.dai@intel.com>
> ---
> drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c b/drivers/net/ixgbe/base/ixgbe_common.c
> index 18bb18c..0dd33b8 100644
> --- a/drivers/net/ixgbe/base/ixgbe_common.c
> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> @@ -1150,7 +1150,7 @@ s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw)
> {
> struct ixgbe_mac_info *mac = &hw->mac;
> u32 led_reg, led_mode;
> - u16 i;
> + u8 i;
>
> led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
>
>
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Wednesday, January 11, 2017 11:38 PM
> To: Dai, Wei <wei.dai@intel.com>; dev@dpdk.org
> Cc: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Subject: Re: [dpdk-dev] [PATCH 2/7] net/ixgbe/base: remove a compiler warning
>
> On 1/10/2017 3:45 PM, Wei Dai wrote:
> > This patch fixes a compiler warning.
>
> I guess compiler warning is because of "mac->led_link_act = i;", since
> led_link_act is 8bits..
>
> But can you please add the compile warning here, to make it more clear to
> understand what is the issue.
I have compared the generated ixgbe_common.o both from "u16 i" and "u8 I" .
Two .o files are identical.
Whether the variable i is defined as u8 or u16, there is no compile warning.
The version of gcc version is 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC).
If i is u16, mac->led_link_act = i; should generate a warning, but there is no.
It is a bit weird .
As you know, this code is provided by another Intel team.
I think that it will generate a warning when they build it with their C compiler.
Anyway, to define i as u8 is better than u16 and we had better keep aligned with them.
>
> >
> > Signed-off-by: Wei Dai <wei.dai@intel.com>
> > ---
> > drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
> > b/drivers/net/ixgbe/base/ixgbe_common.c
> > index 18bb18c..0dd33b8 100644
> > --- a/drivers/net/ixgbe/base/ixgbe_common.c
> > +++ b/drivers/net/ixgbe/base/ixgbe_common.c
> > @@ -1150,7 +1150,7 @@ s32 ixgbe_init_led_link_act_generic(struct
> > ixgbe_hw *hw) {
> > struct ixgbe_mac_info *mac = &hw->mac;
> > u32 led_reg, led_mode;
> > - u16 i;
> > + u8 i;
> >
> > led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
> >
> >
On 1/12/2017 2:08 PM, Dai, Wei wrote:
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Wednesday, January 11, 2017 11:38 PM
>> To: Dai, Wei <wei.dai@intel.com>; dev@dpdk.org
>> Cc: Zhang, Helin <helin.zhang@intel.com>; Ananyev, Konstantin
>> <konstantin.ananyev@intel.com>
>> Subject: Re: [dpdk-dev] [PATCH 2/7] net/ixgbe/base: remove a compiler warning
>>
>> On 1/10/2017 3:45 PM, Wei Dai wrote:
>>> This patch fixes a compiler warning.
>>
>> I guess compiler warning is because of "mac->led_link_act = i;", since
>> led_link_act is 8bits..
>>
>> But can you please add the compile warning here, to make it more clear to
>> understand what is the issue.
>
> I have compared the generated ixgbe_common.o both from "u16 i" and "u8 I" .
> Two .o files are identical.
> Whether the variable i is defined as u8 or u16, there is no compile warning.
> The version of gcc version is 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC).
> If i is u16, mac->led_link_act = i; should generate a warning, but there is no.
> It is a bit weird .
> As you know, this code is provided by another Intel team.
> I think that it will generate a warning when they build it with their C compiler.
> Anyway, to define i as u8 is better than u16 and we had better keep aligned with them.
Agreed, u8 is better.
>
>>
>>>
>>> Signed-off-by: Wei Dai <wei.dai@intel.com>
>>> ---
>>> drivers/net/ixgbe/base/ixgbe_common.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ixgbe/base/ixgbe_common.c
>>> b/drivers/net/ixgbe/base/ixgbe_common.c
>>> index 18bb18c..0dd33b8 100644
>>> --- a/drivers/net/ixgbe/base/ixgbe_common.c
>>> +++ b/drivers/net/ixgbe/base/ixgbe_common.c
>>> @@ -1150,7 +1150,7 @@ s32 ixgbe_init_led_link_act_generic(struct
>>> ixgbe_hw *hw) {
>>> struct ixgbe_mac_info *mac = &hw->mac;
>>> u32 led_reg, led_mode;
>>> - u16 i;
>>> + u8 i;
>>>
>>> led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);
>>>
>>>
>
@@ -1150,7 +1150,7 @@ s32 ixgbe_init_led_link_act_generic(struct ixgbe_hw *hw)
{
struct ixgbe_mac_info *mac = &hw->mac;
u32 led_reg, led_mode;
- u16 i;
+ u8 i;
led_reg = IXGBE_READ_REG(hw, IXGBE_LEDCTL);