iio: temperature: ltc2983: allocate iio channels once
authorCosmin Tanislav <cosmin.tanislav@analog.com>
Fri, 14 Oct 2022 12:37:22 +0000 (15:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Nov 2022 14:59:12 +0000 (23:59 +0900)
commit2f08cad21366697711a8f0d2f19757d99cc0e5b1
tree3380385b89d0b27451c8ba0d8f5b2b45b8924e92
parent1bfe97f49785502832e989a968decf3fec76b096
iio: temperature: ltc2983: allocate iio channels once

commit 4132f19173211856d35180958d2754f5c56d520a upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/temperature/ltc2983.c