提交 703a9ce4 编写于 作者: M Michael Hennerich 提交者: Greg Kroah-Hartman

iio: adc: ad7280a: Fix memory leak

Free channels in case read fails with error.
Signed-off-by: NMichael Hennerich <michael.hennerich@analog.com>
Acked-by: NJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 e15fbc91
......@@ -688,7 +688,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
ret = ad7280_read_all_channels(st, st->scan_cnt, channels);
if (ret < 0)
return IRQ_HANDLED;
goto out;
for (i = 0; i < st->scan_cnt; i++) {
if (((channels[i] >> 23) & 0xF) <= AD7280A_CELL_VOLTAGE_6) {
......@@ -731,6 +731,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
}
}
out:
kfree(channels);
return IRQ_HANDLED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册