From: Ping-Ke Shih <pkshih@realtek.com>
To: You Kangren <youkangren@vivo.com>,
Johannes Berg <johannes@sipsolutions.net>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"open list:MAC80211" <linux-wireless@vger.kernel.org>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Cc: "opensource.kernel@vivo.com" <opensource.kernel@vivo.com>
Subject: RE: [PATCH] wifi:mac80211: Replace the ternary conditional operator with max()
Date: Wed, 28 Jun 2023 01:48:31 +0000 [thread overview]
Message-ID: <9e4e3bf85ed945e7b0c8d5d389065670@realtek.com> (raw)
In-Reply-To: <20230626104829.1896-1-youkangren@vivo.com>
> -----Original Message-----
> From: You Kangren <youkangren@vivo.com>
> Sent: Monday, June 26, 2023 6:48 PM
> To: Johannes Berg <johannes@sipsolutions.net>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; open
> list:MAC80211 <linux-wireless@vger.kernel.org>; open list:NETWORKING [GENERAL] <netdev@vger.kernel.org>;
> open list <linux-kernel@vger.kernel.org>
> Cc: opensource.kernel@vivo.com; youkangren@vivo.com
> Subject: [PATCH] wifi:mac80211: Replace the ternary conditional operator with max()
The semicolon of "wifi:" is different from others.
>
> Replace the ternary conditional operator with max() to make the code clean
>
> Signed-off-by: You Kangren <youkangren@vivo.com>
> ---
> net/mac80211/tdls.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
> index a4af3b7675ef..9f8b0842a616 100644
> --- a/net/mac80211/tdls.c
> +++ b/net/mac80211/tdls.c
> @@ -946,7 +946,7 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata,
> int ret;
> struct ieee80211_link_data *link;
>
> - link_id = link_id >= 0 ? link_id : 0;
> + link_id = max(link_id, 0);
Original logic means "if link_id < 0, then use default link (0)" instead of
"always use link_id larger than or equal to 0". So, I think max(link_id, 0) could
cause misunderstanding.
> rcu_read_lock();
> link = rcu_dereference(sdata->link[link_id]);
> if (WARN_ON(!link))
> --
> 2.39.0
>
>
> ------Please consider the environment before printing this e-mail.
next prev parent reply other threads:[~2023-06-28 1:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 10:48 [PATCH] wifi:mac80211: Replace the ternary conditional operator with max() You Kangren
2023-06-28 1:48 ` Ping-Ke Shih [this message]
2023-06-28 8:00 ` Nicolas Escande
2023-06-29 13:28 ` David Laight
2023-07-03 8:18 ` Ping-Ke Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e4e3bf85ed945e7b0c8d5d389065670@realtek.com \
--to=pkshih@realtek.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=pabeni@redhat.com \
--cc=youkangren@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).