Skip to contentSkip to conversation

drivers/platform/x86/wmi.c bug report

DISCUSSION Darren Hart 1 participant 2 messages May 5, 2016 – May 6, 2016 2 messages not in the archive x86 platform drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · David Binderman

Hello there,

drivers/platform/x86/wmi.c:523]: (style) Redundant condition: wmi_status==AE_OK. 'A || (!A && B)' is equivalent to 'A || B'

Thanks David. Would you care to send a patch?

Quoted 30 lines

Source code is

            if ((wmi_status != AE_OK) ||
                ((wmi_status == AE_OK) && (status == AE_NOT_EXIST)))

Suggest new code

            if ((wmi_status != AE_OK) ||
                (status == AE_NOT_EXIST))

Also:

drivers/platform/x86/wmi.c:567]: (style) Redundant condition: wmi_status==AE_OK. 'A || (!A && B)' is equivalent to 'A || B'

Source code is

                if ((wmi_status != AE_OK) ||
                    ((wmi_status == AE_OK) &&
                     (status == AE_NOT_EXIST)))

Duplicate.

Regards

David Binderman

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 31 lines · David Binderman

Hello there Darren,

----------------------------------------

Quoted 3 lines
Quoted 1 line

drivers/platform/x86/wmi.c:523]: (style) Redundant condition: wmi_status==AE_OK. 'A || (!A && B)' is equivalent to 'A || B'

Thanks David. Would you care to send a patch?

Something like

platform/x86/wmi.c    2016-05-06 06:51:09.497279659 +0100 renamed from platform/x86/wmi.c.sav    2016-05-06 06:50:13.128600783 +0100 +0 -0
@@ -521,7 +521,7 @@


             wmi_status = wmi_method_enable(block, 1);
             if ((wmi_status != AE_OK) ||
-                ((wmi_status == AE_OK) && (status == AE_NOT_EXIST))) +                (status == AE_NOT_EXIST))
                 status = wmi_status;
         }
     }

platform/x86/wmi.c    2016-05-06 06:51:09.497279659 +0100 renamed from platform/x86/wmi.c.sav    2016-05-06 06:50:13.128600783 +0100 +0 -0
@@ -565,8 +565,7 @@
                  block->handler = NULL;
                  block->handler_data = NULL;

                 if ((wmi_status != AE_OK) ||
-                    ((wmi_status == AE_OK) &&
-                     (status == AE_NOT_EXIST)))
+                    (status == AE_NOT_EXIST))
                     status = wmi_status;
             }
         }

Quoted 1 line

with some extra work, would probably work.

Heh, yes, indeed. It was the extra work part I was asking if you would be willing to complete. :-)

If not, thanks for reporting it, we will add this to the todo list.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center