Re: [PATCH v10] Regulator: Add Anatop regulator driver

From: Axel Lin
Date: Thu Mar 08 2012 - 22:00:38 EST


> +       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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/