[dpdk-dev] [PATCH 1/4] net/bnx2x: do not cast function pointers as a policy

Andy Green andy at warmcat.com
Sat May 12 02:25:17 CEST 2018



On 05/12/2018 12:03 AM, Ferruh Yigit wrote:
> On 5/11/2018 2:51 AM, Andy Green wrote:
>> This is stopping the compiler telling you when you have
>> done something stupid... that is something none of us
>> can afford...
>>
>> Now gcc 8.x can tell you did something stupid despite
>> trying to hide the evidence.
>>
>> Remove all the "black magic" casts.
>>
>> Fix the actual problems.
> 
> Missing sign-off
> 
> <...>
> 
>> @@ -5226,9 +5228,9 @@ static elink_status_t elink_get_link_speed_duplex(struct elink_phy *phy,
>>   	return ELINK_STATUS_OK;
>>   }
>>   
>> -static elink_status_t elink_link_settings_status(struct elink_phy *phy,
>> -						 struct elink_params *params,
>> -						 struct elink_vars *vars)
>> +static uint8_t elink_link_settings_status(struct elink_phy *phy,
>> +					  struct elink_params *params,
>> +					  struct elink_vars *vars)
>>   {
> 
> It is possible to remove "read_status_t" casting from phy_serdes and phy_xgxs
> after this change.
> 
> <...>
> 
>> @@ -5520,9 +5522,9 @@ static void elink_set_preemphasis(struct elink_phy *phy,
>>   	}
>>   }
>>   
>> -static void elink_xgxs_config_init(struct elink_phy *phy,
>> -				   struct elink_params *params,
>> -				   struct elink_vars *vars)
>> +static uint8_t elink_xgxs_config_init(struct elink_phy *phy,
>> +				      struct elink_params *params,
>> +				      struct elink_vars *vars)
> 
> Same here, this change can eliminate some "config_init_t" casts.
> 

The first errors from the compile came after phy_serdes and phy_xgxs 
definition, so I did not notice they also have "black magic casts" 
(casting NULL amongst others...) ... I removed all the casts on those as 
well and build is still happy.

-Andy


More information about the dev mailing list