Merge staging-next tree into Linus's latest version
[linux-drm-fsl-dcu.git] / drivers / staging / iio / adc / max1363_core.c
index 4a77657285dac6e185c4507c06934767ae323504..20e267448d1fdffe25eedf5ef35c1b10c2746413 100644 (file)
@@ -958,9 +958,8 @@ static int __devinit max1363_probe(struct i2c_client *client,
        }
 
        st->indio_dev->available_scan_masks
-               = kzalloc(GFP_KERNEL,
-                       sizeof(*st->indio_dev->available_scan_masks)*
-                       (st->chip_info->num_modes + 1));
+               = kzalloc(sizeof(*st->indio_dev->available_scan_masks)*
+                         (st->chip_info->num_modes + 1), GFP_KERNEL);
        if (!st->indio_dev->available_scan_masks) {
                ret = -ENOMEM;
                goto error_free_device;
@@ -1012,6 +1011,7 @@ error_put_reg:
        if (!IS_ERR(st->reg))
                regulator_put(st->reg);
 error_free_st:
+       i2c_set_clientdata(client, NULL);
        kfree(st);
 
 error_ret:
@@ -1030,6 +1030,7 @@ static int max1363_remove(struct i2c_client *client)
                regulator_disable(st->reg);
                regulator_put(st->reg);
        }
+       i2c_set_clientdata(client, NULL);
        kfree(st);
 
        return 0;