ACPI: bus: Drop redundant check in acpi_device_remove()
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sat, 18 Jun 2022 11:23:10 +0000 (13:23 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 30 Jun 2022 12:11:21 +0000 (14:11 +0200)
A bus remove callback is only ever called by the device core with a
bound driver. So there is no need to check if the driver is non-NULL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
[ rjw: Added empty code line after if () ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/bus.c

index 4d7c51a33b016d54b16ec2f03551b55bef81827d..479eec8a1ec6be5c9c70570a88ac83cd98421d33 100644 (file)
@@ -1062,12 +1062,12 @@ static void acpi_device_remove(struct device *dev)
        struct acpi_device *acpi_dev = to_acpi_device(dev);
        struct acpi_driver *acpi_drv = acpi_dev->driver;
 
-       if (acpi_drv) {
-               if (acpi_drv->ops.notify)
-                       acpi_device_remove_notify_handler(acpi_dev);
-               if (acpi_drv->ops.remove)
-                       acpi_drv->ops.remove(acpi_dev);
-       }
+       if (acpi_drv->ops.notify)
+               acpi_device_remove_notify_handler(acpi_dev);
+
+       if (acpi_drv->ops.remove)
+               acpi_drv->ops.remove(acpi_dev);
+
        acpi_dev->driver = NULL;
        acpi_dev->driver_data = NULL;