Commit 090bcfd5 authored by Thomas Gleixner's avatar Thomas Gleixner

Merge branch 'clockevents/4.19-fixes' of...

Merge branch 'clockevents/4.19-fixes' of https://git.linaro.org/people/daniel.lezcano/linux into timers/urgent

Pull another fix from Daniel Lezcano, which felt through the cracks:

 - Fix a potential memory leak reported by smatch in the atmel timer driver
parents 864f893f 52bf4a90
...@@ -180,26 +180,29 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) ...@@ -180,26 +180,29 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
data->base = of_iomap(node, 0); data->base = of_iomap(node, 0);
if (!data->base) { if (!data->base) {
pr_err("Could not map PIT address\n"); pr_err("Could not map PIT address\n");
return -ENXIO; ret = -ENXIO;
goto exit;
} }
data->mck = of_clk_get(node, 0); data->mck = of_clk_get(node, 0);
if (IS_ERR(data->mck)) { if (IS_ERR(data->mck)) {
pr_err("Unable to get mck clk\n"); pr_err("Unable to get mck clk\n");
return PTR_ERR(data->mck); ret = PTR_ERR(data->mck);
goto exit;
} }
ret = clk_prepare_enable(data->mck); ret = clk_prepare_enable(data->mck);
if (ret) { if (ret) {
pr_err("Unable to enable mck\n"); pr_err("Unable to enable mck\n");
return ret; goto exit;
} }
/* Get the interrupts property */ /* Get the interrupts property */
data->irq = irq_of_parse_and_map(node, 0); data->irq = irq_of_parse_and_map(node, 0);
if (!data->irq) { if (!data->irq) {
pr_err("Unable to get IRQ from DT\n"); pr_err("Unable to get IRQ from DT\n");
return -EINVAL; ret = -EINVAL;
goto exit;
} }
/* /*
...@@ -227,7 +230,7 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) ...@@ -227,7 +230,7 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
ret = clocksource_register_hz(&data->clksrc, pit_rate); ret = clocksource_register_hz(&data->clksrc, pit_rate);
if (ret) { if (ret) {
pr_err("Failed to register clocksource\n"); pr_err("Failed to register clocksource\n");
return ret; goto exit;
} }
/* Set up irq handler */ /* Set up irq handler */
...@@ -236,7 +239,8 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) ...@@ -236,7 +239,8 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
"at91_tick", data); "at91_tick", data);
if (ret) { if (ret) {
pr_err("Unable to setup IRQ\n"); pr_err("Unable to setup IRQ\n");
return ret; clocksource_unregister(&data->clksrc);
goto exit;
} }
/* Set up and register clockevents */ /* Set up and register clockevents */
...@@ -254,6 +258,10 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node) ...@@ -254,6 +258,10 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
clockevents_register_device(&data->clkevt); clockevents_register_device(&data->clkevt);
return 0; return 0;
exit:
kfree(data);
return ret;
} }
TIMER_OF_DECLARE(at91sam926x_pit, "atmel,at91sam9260-pit", TIMER_OF_DECLARE(at91sam926x_pit, "atmel,at91sam9260-pit",
at91sam926x_pit_dt_init); at91sam926x_pit_dt_init);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment