]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: xilinx-xadc-core: use devm_kmemdup_array()
authorRaag Jadav <raag.jadav@intel.com>
Wed, 12 Feb 2025 06:25:11 +0000 (11:55 +0530)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 24 Feb 2025 10:08:52 +0000 (12:08 +0200)
Convert to use devm_kmemdup_array() and while at it, use source size
instead of destination.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/iio/adc/xilinx-xadc-core.c

index cfbfcaefec0fcd31007f9cfa9d3e0948802739af..e1f8740ae688b0aeda7e6adf74944be17ed08399 100644 (file)
@@ -1245,8 +1245,8 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, unsigned int *conf, int irq)
                channel_templates = xadc_us_channels;
                max_channels = ARRAY_SIZE(xadc_us_channels);
        }
-       channels = devm_kmemdup(dev, channel_templates,
-                               sizeof(channels[0]) * max_channels, GFP_KERNEL);
+       channels = devm_kmemdup_array(dev, channel_templates, max_channels,
+                                     sizeof(*channel_templates), GFP_KERNEL);
        if (!channels)
                return -ENOMEM;