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

clocksource: tcb_clksrc: Sanitize IRQ request

The clock is not unprepared in case of the request IRQ fails.

Also update to request_irq.

Signed-off-by: Gaël PORTAY <gael.portay@gmail.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Gael Portay and committed by
Daniel Lezcano
2743f1be c387f07e

+4 -9
+4 -9
drivers/clocksource/tcb_clksrc.c
··· 178 178 return IRQ_NONE; 179 179 } 180 180 181 - static struct irqaction tc_irqaction = { 182 - .name = "tc_clkevt", 183 - .flags = IRQF_TIMER, 184 - .handler = ch2_irq, 185 - }; 186 - 187 181 static int __init setup_clkevents(struct atmel_tc *tc, int clk32k_divisor_idx) 188 182 { 189 183 int ret; ··· 192 198 193 199 clkevt.regs = tc->regs; 194 200 clkevt.clk = t2_clk; 195 - tc_irqaction.dev_id = &clkevt; 196 201 197 202 timer_clock = clk32k_divisor_idx; 198 203 199 204 clkevt.clkevt.cpumask = cpumask_of(0); 200 205 201 - ret = setup_irq(irq, &tc_irqaction); 202 - if (ret) 206 + ret = request_irq(irq, ch2_irq, IRQF_TIMER, "tc_clkevt", &clkevt); 207 + if (ret) { 208 + clk_disable_unprepare(t2_clk); 203 209 return ret; 210 + } 204 211 205 212 clockevents_config_and_register(&clkevt.clkevt, 32768, 1, 0xffff); 206 213