mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
lantiq: Fix bug in error handling of timer driver
If the reverted timer driver fails to allocate interrupts handle the error better. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> [moved printk before the cleanup for-loop] Signed-off-by: Martin Schiller <ms@dev.tdt.de>
This commit is contained in:
parent
11baab9fac
commit
e79dacd962
@ -981,7 +981,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+int __init lq_gptu_init(void)
|
+int __init lq_gptu_init(void)
|
||||||
+{
|
+{
|
||||||
+ int ret;
|
+ int ret;
|
||||||
+ unsigned int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
+ ltq_w32(0, LQ_GPTU_IRNEN);
|
+ ltq_w32(0, LQ_GPTU_IRNEN);
|
||||||
+ ltq_w32(0xfff, LQ_GPTU_IRNCR);
|
+ ltq_w32(0xfff, LQ_GPTU_IRNCR);
|
||||||
@ -1007,10 +1007,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
||||||
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||||
+ if (ret) {
|
+ if (ret) {
|
||||||
+ for (; i >= 0; i--)
|
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
||||||
|
+ for (i--; i >= 0; i--)
|
||||||
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
||||||
+ misc_deregister(&gptu_miscdev);
|
+ misc_deregister(&gptu_miscdev);
|
||||||
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
||||||
|
@ -981,7 +981,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+int __init lq_gptu_init(void)
|
+int __init lq_gptu_init(void)
|
||||||
+{
|
+{
|
||||||
+ int ret;
|
+ int ret;
|
||||||
+ unsigned int i;
|
+ int i;
|
||||||
+
|
+
|
||||||
+ ltq_w32(0, LQ_GPTU_IRNEN);
|
+ ltq_w32(0, LQ_GPTU_IRNEN);
|
||||||
+ ltq_w32(0xfff, LQ_GPTU_IRNCR);
|
+ ltq_w32(0xfff, LQ_GPTU_IRNCR);
|
||||||
@ -1007,10 +1007,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
|||||||
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
||||||
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||||
+ if (ret) {
|
+ if (ret) {
|
||||||
+ for (; i >= 0; i--)
|
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
||||||
|
+ for (i--; i >= 0; i--)
|
||||||
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
||||||
+ misc_deregister(&gptu_miscdev);
|
+ misc_deregister(&gptu_miscdev);
|
||||||
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
||||||
|
Loading…
Reference in New Issue
Block a user