staging: iio: Use kcalloc instead of kzalloc to allocate array
[firefly-linux-kernel-4.4.55.git] / drivers / staging / iio / industrialio-core.c
index 0b671663b55d2b9d1c9d07fc566f530f9edbef13..d8cd9e3c07a6e1d3a32b5b8724a9460c3c0ed652 100644 (file)
@@ -85,6 +85,8 @@ static const char * const iio_chan_info_postfix[] = {
        [IIO_CHAN_INFO_PEAK_SCALE] = "peak_scale",
        [IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW] = "quadrature_correction_raw",
        [IIO_CHAN_INFO_AVERAGE_RAW] = "mean_raw",
+       [IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY]
+       = "filter_low_pass_3db_frequency",
 };
 
 /**
@@ -667,10 +669,9 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev)
        if (indio_dev->name)
                attrcount++;
 
-       indio_dev->chan_attr_group.attrs
-               = kzalloc(sizeof(indio_dev->chan_attr_group.attrs[0])*
-                         (attrcount + 1),
-                         GFP_KERNEL);
+       indio_dev->chan_attr_group.attrs = kcalloc(attrcount + 1,
+                                                  sizeof(indio_dev->chan_attr_group.attrs[0]),
+                                                  GFP_KERNEL);
        if (indio_dev->chan_attr_group.attrs == NULL) {
                ret = -ENOMEM;
                goto error_clear_attrs;
@@ -963,10 +964,9 @@ static int iio_device_register_eventset(struct iio_dev *indio_dev)
        }
 
        indio_dev->event_interface->group.name = iio_event_group_name;
-       indio_dev->event_interface->group.attrs =
-               kzalloc(sizeof(indio_dev->event_interface->group.attrs[0])
-                       *(attrcount + 1),
-                       GFP_KERNEL);
+       indio_dev->event_interface->group.attrs = kcalloc(attrcount + 1,
+                                                         sizeof(indio_dev->event_interface->group.attrs[0]),
+                                                         GFP_KERNEL);
        if (indio_dev->event_interface->group.attrs == NULL) {
                ret = -ENOMEM;
                goto error_free_setup_event_lines;