mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 09:50:04 +00:00
alarmtimers: Fix error handling
commit 8bc0daf
(alarmtimers: Rework RTC device selection using class
interface) did not implement required error checks. Add them.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
9fb6033625
commit
4523f6ada8
1 changed files with 32 additions and 11 deletions
|
@ -100,19 +100,25 @@ static struct class_interface alarmtimer_rtc_interface = {
|
||||||
.add_dev = &alarmtimer_rtc_add_device,
|
.add_dev = &alarmtimer_rtc_add_device,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void alarmtimer_rtc_interface_setup(void)
|
static int alarmtimer_rtc_interface_setup(void)
|
||||||
{
|
{
|
||||||
alarmtimer_rtc_interface.class = rtc_class;
|
alarmtimer_rtc_interface.class = rtc_class;
|
||||||
class_interface_register(&alarmtimer_rtc_interface);
|
return class_interface_register(&alarmtimer_rtc_interface);
|
||||||
|
}
|
||||||
|
static void alarmtimer_rtc_interface_remove(void)
|
||||||
|
{
|
||||||
|
class_interface_unregister(&alarmtimer_rtc_interface);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define alarmtimer_get_rtcdev() (0)
|
static inline struct rtc_device *alarmtimer_get_rtcdev(void)
|
||||||
#define rtcdev (0)
|
{
|
||||||
#define alarmtimer_rtc_interface_setup()
|
return NULL;
|
||||||
|
}
|
||||||
|
#define rtcdev (NULL)
|
||||||
|
static inline int alarmtimer_rtc_interface_setup(void) { return 0; }
|
||||||
|
static inline void alarmtimer_rtc_interface_remove(void) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alarmtimer_enqueue - Adds an alarm timer to an alarm_base timerqueue
|
* alarmtimer_enqueue - Adds an alarm timer to an alarm_base timerqueue
|
||||||
* @base: pointer to the base where the timer is being run
|
* @base: pointer to the base where the timer is being run
|
||||||
|
@ -764,6 +770,7 @@ static struct platform_driver alarmtimer_driver = {
|
||||||
*/
|
*/
|
||||||
static int __init alarmtimer_init(void)
|
static int __init alarmtimer_init(void)
|
||||||
{
|
{
|
||||||
|
struct platform_device *pdev;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
int i;
|
int i;
|
||||||
struct k_clock alarm_clock = {
|
struct k_clock alarm_clock = {
|
||||||
|
@ -793,11 +800,25 @@ static int __init alarmtimer_init(void)
|
||||||
alarm_bases[i].timer.function = alarmtimer_fired;
|
alarm_bases[i].timer.function = alarmtimer_fired;
|
||||||
}
|
}
|
||||||
|
|
||||||
alarmtimer_rtc_interface_setup();
|
error = alarmtimer_rtc_interface_setup();
|
||||||
error = platform_driver_register(&alarmtimer_driver);
|
if (error)
|
||||||
platform_device_register_simple("alarmtimer", -1, NULL, 0);
|
return error;
|
||||||
|
|
||||||
|
error = platform_driver_register(&alarmtimer_driver);
|
||||||
|
if (error)
|
||||||
|
goto out_if;
|
||||||
|
|
||||||
|
pdev = platform_device_register_simple("alarmtimer", -1, NULL, 0);
|
||||||
|
if (IS_ERR(pdev)) {
|
||||||
|
error = PTR_ERR(pdev);
|
||||||
|
goto out_drv;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_drv:
|
||||||
|
platform_driver_unregister(&alarmtimer_driver);
|
||||||
|
out_if:
|
||||||
|
alarmtimer_rtc_interface_remove();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
device_initcall(alarmtimer_init);
|
device_initcall(alarmtimer_init);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue