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:57:49 +0000 (23:57 +0900)
commitf19f1a75d378c2d87d98a02e6cb9ffcdc5c9af73
tree97240f499634fab55a4fee7d4de2ee1ec9173783
parentaf236da8552ecbe0ecb779411611826e87d7a831
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