Staging: iio/adc: strict_strtoul was used with a long type variable
[firefly-linux-kernel-4.4.55.git] / drivers / staging / iio / adc / ad7280a.c
index cd3397f95f8084c74fc72abf9f75ecdbad2b91db..3fac9b1fc66c3fa0c11a0663baef725f4c5e52a9 100644 (file)
@@ -456,10 +456,10 @@ static ssize_t ad7280_store_balance_timer(struct device *dev,
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct ad7280_state *st = iio_priv(indio_dev);
        struct iio_dev_attr *this_attr = to_iio_dev_attr(attr);
-       long val;
+       unsigned long val;
        int ret;
 
-       ret = strict_strtoul(buf, 10, &val);
+       ret = kstrtoul(buf, 10, &val);
        if (ret)
                return ret;
 
@@ -488,8 +488,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
 {
        int dev, ch, cnt;
 
-       st->channels = kzalloc(sizeof(*st->channels) *
-                               ((st->slave_num + 1) * 12 + 2), GFP_KERNEL);
+       st->channels = kcalloc((st->slave_num + 1) * 12 + 2,
+                              sizeof(*st->channels), GFP_KERNEL);
        if (st->channels == NULL)
                return -ENOMEM;
 
@@ -683,7 +683,7 @@ static irqreturn_t ad7280_event_handler(int irq, void *private)
        unsigned *channels;
        int i, ret;
 
-       channels = kzalloc(sizeof(*channels) * st->scan_cnt, GFP_KERNEL);
+       channels = kcalloc(st->scan_cnt, sizeof(*channels), GFP_KERNEL);
        if (channels == NULL)
                return IRQ_HANDLED;
 
@@ -970,6 +970,7 @@ static const struct spi_device_id ad7280_id[] = {
        {"ad7280a", 0},
        {}
 };
+MODULE_DEVICE_TABLE(spi, ad7280_id);
 
 static struct spi_driver ad7280_driver = {
        .driver = {