#include <linux/bitfield.h>
 #include <linux/bits.h>
+#include <linux/cleanup.h>
 #include <linux/crc8.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 {
        struct iio_dev *indio_dev = private;
        struct ad7280_state *st = iio_priv(indio_dev);
-       unsigned int *channels;
        int i, ret;
 
-       channels = kcalloc(st->scan_cnt, sizeof(*channels), GFP_KERNEL);
+       unsigned int *channels __free(kfree) = kcalloc(st->scan_cnt, sizeof(*channels),
+                                                      GFP_KERNEL);
        if (!channels)
                return IRQ_HANDLED;
 
        ret = ad7280_read_all_channels(st, st->scan_cnt, channels);
        if (ret < 0)
-               goto out;
+               return IRQ_HANDLED;
 
        for (i = 0; i < st->scan_cnt; i++) {
                unsigned int val;
                }
        }
 
-out:
-       kfree(channels);
-
        return IRQ_HANDLED;
 }