Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
return -EINVAL;
}
- chip = kzalloc(sizeof(struct pm860x_chip), GFP_KERNEL);
+ chip = devm_kzalloc(&client->dev,
+ sizeof(struct pm860x_chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
ret = PTR_ERR(chip->regmap);
dev_err(&client->dev, "Failed to allocate register map: %d\n",
ret);
- kfree(chip);
return ret;
}
chip->client = client;
regmap_exit(chip->regmap_companion);
i2c_unregister_device(chip->companion);
}
- kfree(chip);
return 0;
}