Subject: [PATCH] [acpi driver model] Add NULL checks to conversion helpers. - Check for validity in to_acpi_device() and to_acpi_driver(). Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/core/core.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) applies-to: bbc718fa79f2467982c6c0dc6556e920fadf7930 1df90c77d417413333b04da2a3ac67ba066b08a0 diff --git a/drivers/acpi/drivers/core/core.h b/drivers/acpi/drivers/core/core.h index 201a5d7..a140482 100644 --- a/drivers/acpi/drivers/core/core.h +++ b/drivers/acpi/drivers/core/core.h @@ -10,12 +10,13 @@ static inline struct acpi_dev * to_acpi_dev(struct device * d) { - return container_of(d, struct acpi_dev, dev); + return d ? container_of(d, struct acpi_dev, dev) : NULL; } static inline struct acpi_device_driver * to_acpi_driver(struct device_driver * drv) { - return container_of(drv, struct acpi_device_driver, d_drv); + return drv ? + container_of(drv, struct acpi_device_driver, d_drv) : NULL; } --- 0.99.9.GIT