- if (anatop_reg->control_reg) {
- sel = (uv - anatop_reg->min_voltage) / 25000;
sel = DIV_ROUND_UP(uv - anatop_reg->min_voltage, 25000);
Use DIV_ROUND_UP to avoid the possible truncate of integer division. This ensures the selected volatge falls within the specified range.
+static int __devexit anatop_regulator_remove(struct platform_device *pdev) +{
- struct regulator_dev *rdev = platform_get_drvdata(pdev);
- struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
- kfree(sreg->name);
- regulator_unregister(rdev);
Do regulator_unregister before kfree sreg->name.