netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [rtlwifi-btcoex] Suspicious code in halbtc8821a1ant driver
@ 2018-04-05  1:25 Gustavo A. R. Silva
  2018-04-05  2:06 ` Pkshih
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2018-04-05  1:25 UTC (permalink / raw)
  To: Yan-Hsuan Chuang, Ping-Ke Shih, Kalle Valo
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Gustavo A. R. Silva

Hi all,

While doing some static analysis I came across the following piece of code at drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c:1581:

1581 static void btc8821a1ant_act_bt_sco_hid_only_busy(struct btc_coexist *btcoexist,
1582                                                   u8 wifi_status)
1583 {
1584         /* tdma and coex table */
1585         btc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 5);
1586 
1587         if (BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN ==
1588             wifi_status)
1589                 btc8821a1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
1590         else
1591                 btc8821a1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
1592 }

The issue here is that the code for both branches of the if-else statement is identical.

The if-else was introduced a year ago in this commit c6821613e653

I wonder if an argument should be changed in any of the calls to btc8821a1ant_coex_table_with_type?

What do you think?

Thanks
--
Gustavo

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

* Re: [rtlwifi-btcoex] Suspicious code in halbtc8821a1ant driver
  2018-04-05  1:25 [rtlwifi-btcoex] Suspicious code in halbtc8821a1ant driver Gustavo A. R. Silva
@ 2018-04-05  2:06 ` Pkshih
  0 siblings, 0 replies; 2+ messages in thread
From: Pkshih @ 2018-04-05  2:06 UTC (permalink / raw)
  To: 莊彥宣, kvalo@codeaurora.org,
	gustavo@embeddedor.com
  Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Thu, 2018-04-05 at 01:25 +0000, Gustavo A. R. Silva wrote:
> Hi all,
> 
> While doing some static analysis I came across the following piece of code at
> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a1ant.c:1581:
> 
> 1581 static void btc8821a1ant_act_bt_sco_hid_only_busy(struct btc_coexist *btcoexist,
> 1582                                                   u8 wifi_status)
> 1583 {
> 1584         /* tdma and coex table */
> 1585         btc8821a1ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 5);
> 1586 
> 1587         if (BT_8821A_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN ==
> 1588             wifi_status)
> 1589                 btc8821a1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
> 1590         else
> 1591                 btc8821a1ant_coex_table_with_type(btcoexist, NORMAL_EXEC, 1);
> 1592 }
> 
> The issue here is that the code for both branches of the if-else statement is identical.
> 
> The if-else was introduced a year ago in this commit c6821613e653
> 
> I wonder if an argument should be changed in any of the calls to
> btc8821a1ant_coex_table_with_type?
> 
> 

It looks weird. Since we're in spring vacation, I'll check my colleague next Monday.

PK


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

end of thread, other threads:[~2018-04-05  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05  1:25 [rtlwifi-btcoex] Suspicious code in halbtc8821a1ant driver Gustavo A. R. Silva
2018-04-05  2:06 ` Pkshih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).