iio: temperature: ltc2983: allocate iio channels once
authorCosmin Tanislav <cosmin.tanislav@analog.com>
Fri, 14 Oct 2022 12:37:22 +0000 (15:37 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 Oct 2022 07:51:26 +0000 (08:51 +0100)
commit4132f19173211856d35180958d2754f5c56d520a
tree44e35e3a676e72f5cb40eee2c86ed5d93e924497
parent72b2aa38191bcba28389b0e20bf6b4f15017ff2b
iio: temperature: ltc2983: allocate iio channels once

Currently, every time the device wakes up from sleep, the
iio_chan array is reallocated, leaking the previous one
until the device is removed (basically never).

Move the allocation to the probe function to avoid this.

Signed-off-by: Cosmin Tanislav <cosmin.tanislav@analog.com>
Fixes: f110f3188e563 ("iio: temperature: Add support for LTC2983")
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221014123724.1401011-2-demonsingur@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/temperature/ltc2983.c