iio: adc: ina2xx: Avoid double reference counting from get_task_struct/put_task_struct()
authorCai Huoqing <caihuoqing@baidu.com>
Thu, 21 Oct 2021 12:42:54 +0000 (20:42 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 17 Nov 2021 17:51:34 +0000 (17:51 +0000)
kthread_run() and kthread_stop() already do reference
counting of the task, so remove get_task_struct/put_task_struct()
to avoid double reference counting.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20211021124254.3247-2-caihuoqing@baidu.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ina2xx-adc.c

index 360d7a00f60d96ac86548017217e08b257ddb463..352f276572384898a4f68bcaee3d8a308c74c5ff 100644 (file)
@@ -849,7 +849,6 @@ static int ina2xx_buffer_enable(struct iio_dev *indio_dev)
        if (IS_ERR(task))
                return PTR_ERR(task);
 
-       get_task_struct(task);
        chip->task = task;
 
        return 0;
@@ -861,7 +860,6 @@ static int ina2xx_buffer_disable(struct iio_dev *indio_dev)
 
        if (chip->task) {
                kthread_stop(chip->task);
-               put_task_struct(chip->task);
                chip->task = NULL;
        }