[PATCH] acpi: uniqueid: clean up pedantic static analysis warnings
Ivan Hu
ivan.hu at canonical.com
Tue Nov 30 08:20:52 UTC 2021
Clean up static analysis warning of dereference before null check
(REVERSE_INULL).
Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
---
src/acpi/uniqueid/uniqueid.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/acpi/uniqueid/uniqueid.c b/src/acpi/uniqueid/uniqueid.c
index f745dfe5..7d150015 100644
--- a/src/acpi/uniqueid/uniqueid.c
+++ b/src/acpi/uniqueid/uniqueid.c
@@ -108,11 +108,11 @@ static bool is_uniqueid_equal(acpi_ids *obj1, acpi_ids *obj2)
{
bool hid_match = false;
- /* _HID and _CID are in the same device */
- if (!strncmp(obj1->hid_name, obj2->hid_name, strlen(obj1->hid_name) - 4))
+ if (obj1 == NULL || obj2 == NULL)
return false;
- if (obj1 == NULL || obj2 == NULL)
+ /* _HID and _CID are in the same device */
+ if (!strncmp(obj1->hid_name, obj2->hid_name, strlen(obj1->hid_name) - 4))
return false;
if ((obj1->hid_obj->Type != obj2->hid_obj->Type) || (obj1->uid_obj->Type != obj2->uid_obj->Type))
--
2.25.1
More information about the fwts-devel
mailing list