batman-adv: remove unnecessary type castings

Message ID 20220425113635.1609532-1-yuzhe@nfschina.com (mailing list archive)
State Superseded, archived
Delegated to: Simon Wunderlich
Headers
Series batman-adv: remove unnecessary type castings |

Commit Message

Yu Zhe April 25, 2022, 11:36 a.m. UTC
  remove unnecessary void* type castings.

Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
---
 net/batman-adv/translation-table.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Sven Eckelmann April 25, 2022, 12:50 p.m. UTC | #1
On Monday, 25 April 2022 13:36:35 CEST Yu Zhe wrote:
> remove unnecessary void* type castings.
> 
> Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
> ---
>  net/batman-adv/translation-table.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

If you send a second version then please use `git format-patch -v2 ...` to 
format the patch. Now it looks in patchworks like you've resent the first 
version again. And please also add a little changelog after "---" which 
explains what you've changed. It is trivial in this little patch but still 
might be useful.

Regarding the patch: Now you've removed bridge_loop_avoidance.c + 
batadv_choose_tt instead of fixing your patch. I would really prefer this 
patch version:

https://git.open-mesh.org/linux-merge.git/commitdiff/8864d2fcf04385cabb8c8bb159f1f2ba5790cf71

Kind regards,
	Sven
  
Yu Zhe April 26, 2022, 9:52 a.m. UTC | #2
I agree, this patch is better. And I have tested, no sparse warning anymore.

Thank your for your help.

       

在 2022/4/25 20:50, Sven Eckelmann 写道:

     

>        
> On Monday, 25 April 2022 13:36:35 CEST Yu Zhe wrote:
>        
>>          
>> remove unnecessary void* type castings.
>>
>> Signed-off-by: Yu Zhe<yuzhe@nfschina.com>
>> ---
>>   net/batman-adv/translation-table.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>        
>        
> If you send a second version then please use `git format-patch -v2 ...` to
> format the patch. Now it looks in patchworks like you've resent the first
> version again. And please also add a little changelog after "---" which
> explains what you've changed. It is trivial in this little patch but still
> might be useful.
>
> Regarding the patch: Now you've removed bridge_loop_avoidance.c +
> batadv_choose_tt instead of fixing your patch. I would really prefer this
> patch version:
>
> https://git.open-mesh.org/linux-merge.git/commitdiff/8864d2fcf04385cabb8c8bb159f1f2ba5790cf71
>
> Kind regards,
> 	Sven
>
  

Patch

diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 8478034d3abf..cbf96eebf05b 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -2766,7 +2766,7 @@  static void batadv_tt_tvlv_generate(struct batadv_priv *bat_priv,
 	u32 i;
 
 	tt_tot = batadv_tt_entries(tt_len);
-	tt_change = (struct batadv_tvlv_tt_change *)tvlv_buff;
+	tt_change = tvlv_buff;
 
 	if (!valid_cb)
 		return;
@@ -3994,7 +3994,7 @@  static void batadv_tt_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
 	if (tvlv_value_len < sizeof(*tt_data))
 		return;
 
-	tt_data = (struct batadv_tvlv_tt_data *)tvlv_value;
+	tt_data = tvlv_value;
 	tvlv_value_len -= sizeof(*tt_data);
 
 	num_vlan = ntohs(tt_data->num_vlan);
@@ -4037,7 +4037,7 @@  static int batadv_tt_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
 	if (tvlv_value_len < sizeof(*tt_data))
 		return NET_RX_SUCCESS;
 
-	tt_data = (struct batadv_tvlv_tt_data *)tvlv_value;
+	tt_data = tvlv_value;
 	tvlv_value_len -= sizeof(*tt_data);
 
 	tt_vlan_len = sizeof(struct batadv_tvlv_tt_vlan_data);
@@ -4129,7 +4129,7 @@  static int batadv_roam_tvlv_unicast_handler_v1(struct batadv_priv *bat_priv,
 		goto out;
 
 	batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
-	roaming_adv = (struct batadv_tvlv_roam_adv *)tvlv_value;
+	roaming_adv = tvlv_value;
 
 	batadv_dbg(BATADV_DBG_TT, bat_priv,
 		   "Received ROAMING_ADV from %pM (client %pM)\n",