Re: [PATCH v4 4/7] staging: rtl8723bs: rtw_mlme: extract local variables for long expressions

Dan Carpenter
2026-04-28T11:55:13Z

On Tue, Apr 28, 2026 at 12:10:38PM +0300, Dan Carpenter wrote:
> On Mon, Apr 27, 2026 at 10:05:32PM +0300, Salman Alghamdi wrote:
> > @@ -772,9 +783,14 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
> > rtw_indicate_connect(adapter);
> > } else {
> > if (rtw_to_roam(adapter) != 0) {
> > - if (rtw_dec_to_roam(adapter) == 0
> > - || _SUCCESS != rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid, 1, NULL, 0)
> > - ) {
> > + bool roam_failed = false;
> > +
> > + if (rtw_dec_to_roam(adapter) == 0)
> > + roam_failed = true;
> > + else if (rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid,
> > + 1, NULL, 0) != _SUCCESS)
> > + roam_failed = true;
> > + if (roam_failed) {
>
> Just write this as:
> if (!rtw_dec_to_roam(adapter) ||
> rtw_sitesurvey_cmd(adapter, &pmlmepriv->assoc_ssid,
> 1, NULL, 0) != _SUCCESS) {
>
> The "roam_failed" variable isn't beautiful and the if else makes the line
> five characters longer than it would be otherwise. Eventually we'll get
> rid of the _SUCCESS but I like it to look ugly so we know which code to
> change.

Do it by itself. It doesn't fit in with patch 3 which just does
newline and it doesn't really fit in with this patch either.

regards,
dan carpenter