All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG ?] staging: rtl8723au: condition with no effect
@ 2015-06-13 10:31 Nicholas Mc Guire
  2015-06-13 21:48 ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-06-13 10:31 UTC (permalink / raw)
  To: Larry Finger
  Cc: Jes Sorensen, Greg Kroah-Hartman, Roberta Dobrescu, Joe Perches,
	Daniele Alessandrelli, Aleh Suprunovich, linux-wireless, devel,
	linux-kernel, Nicholas Mc Guire

scanning for trivial bug-patters with coccinelle spatches returned:
./drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1395
	WARNING: condition with no effect (if branch == else)

drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c - line numbers from 4.1-rc7
1395    if (bWithoutHWSM) {
1396            /* value16 |= (APDM_HOST | FSM_HSUS |/PFM_ALDN); */
1397            /*  2010/08/31 According to Filen description, we need to
1398                use HW to shut down 8051 automatically. */
1399            /*  Because suspend operation need the asistance of 8051
1400                to wait for 3ms. */
1401            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
1402    } else {
1403            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
1404    }
1405 
1406    rtl8723au_write16(padapter, REG_APS_FSMCO, value16);    /* 0x4802 */

Not clear what the intent is but this looks like a typo/bug in the assigment
of value16 as the condition here has no effect.

thx!
hofrat

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

* Re: [BUG ?] staging: rtl8723au: condition with no effect
  2015-06-13 10:31 [BUG ?] staging: rtl8723au: condition with no effect Nicholas Mc Guire
@ 2015-06-13 21:48 ` Jes Sorensen
  2015-06-14  6:19   ` Nicholas Mc Guire
  0 siblings, 1 reply; 4+ messages in thread
From: Jes Sorensen @ 2015-06-13 21:48 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Larry Finger, Greg Kroah-Hartman, Roberta Dobrescu, Joe Perches,
	Daniele Alessandrelli, Aleh Suprunovich, linux-wireless, devel,
	linux-kernel

Nicholas Mc Guire <hofrat@osadl.org> writes:
> scanning for trivial bug-patters with coccinelle spatches returned:
> ./drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1395
> 	WARNING: condition with no effect (if branch == else)
>
> drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c - line numbers from 4.1-rc7
> 1395    if (bWithoutHWSM) {
> 1396            /* value16 |= (APDM_HOST | FSM_HSUS |/PFM_ALDN); */
> 1397            /*  2010/08/31 According to Filen description, we need to
> 1398                use HW to shut down 8051 automatically. */
> 1399            /*  Because suspend operation need the asistance of 8051
> 1400                to wait for 3ms. */
> 1401            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
> 1402    } else {
> 1403            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
> 1404    }
> 1405 
> 1406    rtl8723au_write16(padapter, REG_APS_FSMCO, value16);    /* 0x4802 */
>
> Not clear what the intent is but this looks like a typo/bug in the assigment
> of value16 as the condition here has no effect.

Doesn't look like a typo, looks like someone at some point had commented
out PFM_ALDN in the bWithoutHWSM case. Why they did that and then later
overrode it, I have no idea.

Jes



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

* Re: [BUG ?] staging: rtl8723au: condition with no effect
  2015-06-13 21:48 ` Jes Sorensen
@ 2015-06-14  6:19   ` Nicholas Mc Guire
  2015-06-14 14:51     ` Jes Sorensen
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-06-14  6:19 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Nicholas Mc Guire, Larry Finger, Greg Kroah-Hartman,
	Roberta Dobrescu, Joe Perches, Daniele Alessandrelli,
	Aleh Suprunovich, linux-wireless, devel, linux-kernel

On Sat, 13 Jun 2015, Jes Sorensen wrote:

> Nicholas Mc Guire <hofrat@osadl.org> writes:
> > scanning for trivial bug-patters with coccinelle spatches returned:
> > ./drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1395
> > 	WARNING: condition with no effect (if branch == else)
> >
> > drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c - line numbers from 4.1-rc7
> > 1395    if (bWithoutHWSM) {
> > 1396            /* value16 |= (APDM_HOST | FSM_HSUS |/PFM_ALDN); */
> > 1397            /*  2010/08/31 According to Filen description, we need to
> > 1398                use HW to shut down 8051 automatically. */
> > 1399            /*  Because suspend operation need the asistance of 8051
> > 1400                to wait for 3ms. */
> > 1401            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
> > 1402    } else {
> > 1403            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
> > 1404    }
> > 1405 
> > 1406    rtl8723au_write16(padapter, REG_APS_FSMCO, value16);    /* 0x4802 */
> >
> > Not clear what the intent is but this looks like a typo/bug in the assigment
> > of value16 as the condition here has no effect.
> 
> Doesn't look like a typo, looks like someone at some point had commented
> out PFM_ALDN in the bWithoutHWSM case. Why they did that and then later
> overrode it, I have no idea.
>
as far as its traceable in git log if == else was in there from the
very beginning (including that comment) - both the if and else were
updated in commit cffca68d7b2f ("staging: rtl8723au: _DisableAnalog(): Avoid
zero-init variables unnecessaril") but without changing PFM_ALDN - as there
are no comments to the meaning of these bits in the header file there is
no way to really come up with a resonable patch. anyway its either wrong 
settings or the condition should be removed.

thx!
hofrat

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

* Re: [BUG ?] staging: rtl8723au: condition with no effect
  2015-06-14  6:19   ` Nicholas Mc Guire
@ 2015-06-14 14:51     ` Jes Sorensen
  0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2015-06-14 14:51 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Nicholas Mc Guire, Larry Finger, Greg Kroah-Hartman,
	Roberta Dobrescu, Joe Perches, Daniele Alessandrelli,
	Aleh Suprunovich, linux-wireless, devel, linux-kernel

Nicholas Mc Guire <der.herr@hofr.at> writes:
> On Sat, 13 Jun 2015, Jes Sorensen wrote:
>
>> Nicholas Mc Guire <hofrat@osadl.org> writes:
>> > scanning for trivial bug-patters with coccinelle spatches returned:
>> > ./drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1395
>> > 	WARNING: condition with no effect (if branch == else)
>> >
>> > drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c - line numbers
>> > from 4.1-rc7
>> > 1395    if (bWithoutHWSM) {
>> > 1396            /* value16 |= (APDM_HOST | FSM_HSUS |/PFM_ALDN); */
>> > 1397            /*  2010/08/31 According to Filen description, we need to
>> > 1398                use HW to shut down 8051 automatically. */
>> > 1399            /*  Because suspend operation need the asistance of 8051
>> > 1400                to wait for 3ms. */
>> > 1401            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
>> > 1402    } else {
>> > 1403            value16 = APDM_HOST | AFSM_HSUS | PFM_ALDN;
>> > 1404    }
>> > 1405 
>> > 1406    rtl8723au_write16(padapter, REG_APS_FSMCO, value16);    /* 0x4802 */
>> >
>> > Not clear what the intent is but this looks like a typo/bug in the assigment
>> > of value16 as the condition here has no effect.
>> 
>> Doesn't look like a typo, looks like someone at some point had commented
>> out PFM_ALDN in the bWithoutHWSM case. Why they did that and then later
>> overrode it, I have no idea.
>>
> as far as its traceable in git log if == else was in there from the
> very beginning (including that comment) - both the if and else were
> updated in commit cffca68d7b2f ("staging: rtl8723au: _DisableAnalog(): Avoid
> zero-init variables unnecessaril") but without changing PFM_ALDN - as there
> are no comments to the meaning of these bits in the header file there is
> no way to really come up with a resonable patch. anyway its either wrong 
> settings or the condition should be removed.

There's a much longer history of this code going back to the vendor
origin - it shouldn't be removed unless we can get clarification from
them why that was.

Jes

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

end of thread, other threads:[~2015-06-14 14:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-13 10:31 [BUG ?] staging: rtl8723au: condition with no effect Nicholas Mc Guire
2015-06-13 21:48 ` Jes Sorensen
2015-06-14  6:19   ` Nicholas Mc Guire
2015-06-14 14:51     ` Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.