Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: TAD: Use devres for all driver cleanup

The code in acpi_tad_remove() needs to run after the unregistration of
the devres-managed RTC class device so that it doesn't race with the
class callbacks of the latter.

To make that happen, pass it to devm_add_action_or_reset() before
registering the RTC class device.

Fixes: 7572dcabe38d ("ACPI: TAD: Add alarm support to the RTC class device interface")
Fixes: 8a1e7f4b1764 ("ACPI: TAD: Add RTC class device interface")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/14001754.uLZWGnKmhe@rafael.j.wysocki

+11 -3
+11 -3
drivers/acpi/acpi_tad.c
··· 792 792 return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED); 793 793 } 794 794 795 - static void acpi_tad_remove(struct platform_device *pdev) 795 + static void acpi_tad_remove(void *data) 796 796 { 797 - struct device *dev = &pdev->dev; 797 + struct device *dev = data; 798 798 struct acpi_tad_driver_data *dd = dev_get_drvdata(dev); 799 799 800 800 device_init_wakeup(dev, false); ··· 821 821 struct acpi_tad_driver_data *dd; 822 822 acpi_status status; 823 823 unsigned long long caps; 824 + int ret; 824 825 825 826 /* 826 827 * Initialization failure messages are mostly about firmware issues, so ··· 868 867 pm_runtime_enable(dev); 869 868 pm_runtime_suspend(dev); 870 869 870 + /* 871 + * acpi_tad_remove() needs to run after unregistering the RTC class 872 + * device to avoid racing with the latter's callbacks. 873 + */ 874 + ret = devm_add_action_or_reset(&pdev->dev, acpi_tad_remove, &pdev->dev); 875 + if (ret) 876 + return ret; 877 + 871 878 if (caps & ACPI_TAD_RT) 872 879 acpi_tad_register_rtc(dev, caps); 873 880 ··· 894 885 .dev_groups = acpi_tad_groups, 895 886 }, 896 887 .probe = acpi_tad_probe, 897 - .remove = acpi_tad_remove, 898 888 }; 899 889 MODULE_DEVICE_TABLE(acpi, acpi_tad_ids); 900 890