Skip to contentSkip to conversation

staging: rtl8723bs: bug or pointless if else ?

DISCUSSION Michael Straube 5 participants 7 messages Jun 27, 2018 – Jun 28, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

        if (pwrpriv->bInternalAutoSuspend)
        {
                ret = rtw_resume_process(padapter);
        }
        else
        {
                if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
                {
                        ret = rtw_resume_process(padapter);
                }
                else
                {
                        ret = rtw_resume_process(padapter);
                }
        }

It does not matter if the conditions are true or not, ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

Regards,
Michael

#1 lore raw

Hi,

Quoted 21 lines · Michael Straube

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

        if (pwrpriv->bInternalAutoSuspend)
        {
                ret = rtw_resume_process(padapter);
        }
        else
        {
                if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode) {
                        ret = rtw_resume_process(padapter); }
                else
                {
                        ret = rtw_resume_process(padapter); }
        }

Quoted 6 lines

It does not matter if the conditions are true or not, ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

It probably is just pointless, my guess would be that once upon a time there was a difference in the paths and at some point that difference went away.

Regards,

Hans

#2 lore raw
Quoted 28 lines · Hans de Goede

Hi,

Quoted 25 lines · Michael Straube

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

         if (pwrpriv->bInternalAutoSuspend)
         {
                 ret = rtw_resume_process(padapter);
         }
         else
         {
                 if (pwrpriv->wowlan_mode || pwrpriv-
Quoted 1 line

wowlan_ap_mode)

                 {
                         ret = rtw_resume_process(padapter);
                 }
                 else
                 {
                         ret = rtw_resume_process(padapter);
                 }
         }

It does not matter if the conditions are true or not, ret is always set to:

Quoted 7 lines
Quoted 3 lines

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

It probably is just pointless, my guess would be that once upon a time there was a difference in the paths and at some point that difference went away.

Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757

#3 lore raw
Quoted 31 lines · Bastien Nocera
Quoted 30 lines · Hans de Goede

Hi,

Quoted 27 lines · Michael Straube

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

          if (pwrpriv->bInternalAutoSuspend)
          {
                  ret = rtw_resume_process(padapter);
          }
          else
          {
                  if (pwrpriv->wowlan_mode || pwrpriv-
Quoted 1 line

wowlan_ap_mode)

                  {
                          ret = rtw_resume_process(padapter);
                  }
                  else
                  {
                          ret = rtw_resume_process(padapter);
                  }
          }

It does not matter if the conditions are true or not, ret is always set to:

ret = rtw_resume_process(padapter)

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

Is this a bug or is the if else construct just pointless?

It probably is just pointless, my guess would be that once upon a time there was a difference in the paths and at some point that difference went away.

Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757

So it can be safly removed?

#4 lore raw

Hi,

Quoted 38 lines · Michael Straube
Quoted 37 lines · Bastien Nocera
Quoted 35 lines · Hans de Goede

Hi,

Quoted 22 lines · Michael Straube

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

          if (pwrpriv->bInternalAutoSuspend) {
                  ret = rtw_resume_process(padapter); }
          else
          {
                  if (pwrpriv->wowlan_mode || pwrpriv-

Quoted 1 line

wowlan_ap_mode)

                  {
                          ret = rtw_resume_process(padapter); }
                  else
                  {
                          ret = rtw_resume_process(padapter); }
          }

Quoted 6 lines

It does not matter if the conditions are true or not, ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

It probably is just pointless, my guess would be that once upon a time there was a difference in the paths and at some point that difference went away.

Quoted 5 lines
Quoted 3 lines

Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757

So it can be safly removed?

Simplified to a single:

	ret = rtw_resume_process(padapter);

Yes that should be fine.

Regards,

Hans

#5 lore raw
In reply to Bastien Nocera
Quoted 10 lines · Bastien Nocera
Quoted 6 lines · Hans de Goede
Quoted 2 lines · Michael Straube

ret = rtw_resume_process(padapter)
Is this a bug or is the if else construct just pointless?

It probably is just pointless, my guess would be that once upon a time there was a difference in the paths and at some point that difference went away.

Quite:
https://github.com/hadess/rtl8723bs/blob/7d36e26f78bbc709844c12ad0c62e3e8503fdbc5/os_dep/linux/sdio_intf.c#L1757

That #ifdef forest is/was quite unsightly.
No wonder the realtek code is unmaintainable.

#6 lore raw
In reply to Michael Straube
Quoted 21 lines · Michael Straube

Hi,

I stumbled upon the following if else construct in drivers/staging/rtl8723bs/os_dep/sdio_intf.c:618

        if (pwrpriv->bInternalAutoSuspend)
        {
                ret = rtw_resume_process(padapter);
        }
        else
        {
                if (pwrpriv->wowlan_mode || pwrpriv->wowlan_ap_mode)
                {
                        ret = rtw_resume_process(padapter);
                }
                else
                {
                        ret = rtw_resume_process(padapter);
                }
        }
Quoted 6 lines

It does not matter if the conditions are true or not, ret is always set to:

ret = rtw_resume_process(padapter)

Is this a bug or is the if else construct just pointless?

Looks pretty pointless...