genirq/timings: Fix error return code in irq_timings_test_irqs()
PATCH 1/1 genirq/timings: Fix error return code in irq_timings_test_irqs()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- kernel/irq/timings.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/irq/timings.c +2 -0
@@ -794,12 +794,14 @@ static int __init irq_timings_test_irqs(struct timings_intervals *ti)__irq_timings_store (irq, irqs, ti->intervals[i]);if (irqs->circ_timings[i &IRQ_TIMINGS_MASK ] != index) { + ret = -EFAULT ;pr_err ("Failed to store in the circular buffer\n" ); goto out; } }if (irqs->count != ti->count) { + ret = -EFAULT ;pr_err ("Count differs\n" ); goto out; }
Signature · 1 line
2.25.1
Quoted 2 lines · Zhen Lei
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
Returning an error code is fine, but
kernel/irq/timings.c static int __init irq_timings_test_irqs(struct timings_intervals *ti) · line 797
Quoted 4 lines
kernel/irq/timings.c +1
-0__irq_timings_store (irq, irqs, ti->intervals[i]);if (irqs->circ_timings[i &IRQ_TIMINGS_MASK ] != index) { + ret = -EFAULT ;
EFAULT is really not appropriate here. EFAULT is used for mapping faults. ENOSPC or EBADSLT perhaps?
kernel/irq/timings.c static int __init irq_timings_test_irqs(struct timings_intervals *ti) · line 804
Quoted 7 lines
kernel/irq/timings.c +1
-0pr_err ("Failed to store in the circular buffer\n" ); goto out; } }if (irqs->count != ti->count) { + ret = -EFAULT ;
ERANGE?
Thanks,
tglx
Quoted 7 lines · Thomas Gleixner
Quoted 2 lines · Zhen Lei
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
Returning an error code is fine, but
Quoted 1 line
Quoted 6 lines
kernel/irq/timings.c static int __init irq_timings_test_irqs(struct timings_intervals *ti) · line 797
Quoted 3 lines
kernel/irq/timings.c +1
-0__irq_timings_store (irq, irqs, ti->intervals[i]);if (irqs->circ_timings[i &IRQ_TIMINGS_MASK ] != index) { + ret = -EFAULT ;EFAULT is really not appropriate here. EFAULT is used for mapping faults. ENOSPC or EBADSLT perhaps?
EBADSLT will be better, the cyclic buffer can not be "no space".
Quoted 10 lines
kernel/irq/timings.c static int __init irq_timings_test_irqs(struct timings_intervals *ti) · line 804
Quoted 8 lines
kernel/irq/timings.c +1
-0pr_err ("Failed to store in the circular buffer\n" ); goto out; } }if (irqs->count != ti->count) { + ret = -EFAULT ;ERANGE?
Looks better than EFAULT.
Thank you for your suggestion, I will send v2.
Quoted 6 lines
Thanks,
tglx
.