Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63340 )
Change subject: drivers/wifi/generic/acpi.c: NULL-check pointers before dereferencing ......................................................................
drivers/wifi/generic/acpi.c: NULL-check pointers before dereferencing
Checking whether a pointer is NULL after it has been dereferenced makes zero sense. Make sure the `wifi_ssdt_write_properties()` function never gets invoked with a NULL argument for the `dev` parameter, and simplify the logic around the `is_cnvi_ddr_rfim_enabled` variable accordingly.
Change-Id: I3fbc9565e7e9b4e1c14a68f6a5fd779577045236 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/63340 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Singer felixsinger@posteo.net Reviewed-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/drivers/wifi/generic/acpi.c 1 file changed, 4 insertions(+), 4 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 65940d6..ee09631 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -533,11 +533,9 @@
static void wifi_ssdt_write_properties(const struct device *dev, const char *scope) { - bool is_cnvi_ddr_rfim_enabled = false; - const struct drivers_wifi_generic_config *config = dev->chip_info; - if (dev && config) - is_cnvi_ddr_rfim_enabled = config->enable_cnvi_ddr_rfim; + + bool is_cnvi_ddr_rfim_enabled = config && config->enable_cnvi_ddr_rfim;
/* Scope */ acpigen_write_scope(scope); @@ -646,6 +644,8 @@ void wifi_cnvi_fill_ssdt(const struct device *dev) { const char *path; + if (!dev) + return;
path = acpi_device_path(dev->bus->dev); if (!path)