lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 8 Jul 2014 09:36:19 +0200
From:	Mark Brown <broonie@...nel.org>
To:	James Ban <james.ban.opensource@...semi.com>
Cc:	Liam Girdwood <lgirdwood@...il.com>,
	Support Opensource <support.opensource@...semi.com>,
	LKML <linux-kernel@...r.kernel.org>,
	David Dajun Chen <david.chen@...semi.com>
Subject: Re: [PATCH V4] regulator: DA9211 : new regulator driver

On Thu, Jul 03, 2014 at 04:29:03PM +0900, James Ban wrote:

This is greatly improved, thanks, however there are still a few issues
which should be addressed:

> +static irqreturn_t da9211_irq_handler(int irq, void *data)
> +{
> +	struct da9211 *chip = data;
> +	int reg_val, ret;
> +
> +	ret = regmap_read(chip->regmap, DA9211_REG_EVENT_B, &reg_val);
> +	if (ret < 0)
> +		goto error_i2c;
> +
> +	if (reg_val & DA9211_E_OV_CURR_A) {

> +	if (reg_val & DA9211_E_OV_CURR_B) {

> +
> +	return IRQ_HANDLED;

This is buggy - the driver should only return IRQ_HANDLED if it handled
the interrupt somehow, otherwise it should return IRQ_NONE and let the
interrupt core handle things.  This is especially important since the
device appears to require that interrupts are explicitly acknoweldged so
if something is flagged but not handled the interrupt will just sit
constantly asserted.

> +static int da9211_regulator_init(struct da9211 *chip)
> +{
> +	struct regulator_config config = { };
> +	int i, ret;
> +	unsigned int data;
> +
> +	ret = regmap_update_bits(chip->regmap, DA9211_REG_PAGE_CON,
> +			DA9211_REG_PAGE_MASK, DA9211_REG_PAGE2);
> +	if (ret < 0) {
> +		dev_err(chip->dev, "Failed to update PAGE reg: %d\n", ret);
> +		goto err;
> +	}

It would be better to model the paging in the register map in the regmap
- the API has support for this, it's going to be more robust to use it.

> +		dev_info(chip->dev, "# IRQ configured [%d]\n", chip->chip_irq);

> +	for (i = 0; i < chip->num_regulator; i++)
> +		regulator_unregister(chip->rdev[i]);

Use devm_regulator_register().

> +	if (chip->chip_irq != 0)
> +		free_irq(chip->chip_irq, chip);

devm_request_threaded_irq().

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ