Re: [PATCH 1/4] gpiolib: introduce descriptor-based GPIO interface

From: Thierry Reding
Date: Thu Jan 10 2013 - 03:36:51 EST


On Wed, Jan 09, 2013 at 11:10:55AM +0000, Russell King - ARM Linux wrote:
[...]
> err = gpio_request(en_vdd_1v05, "EN_VDD_1V05");
> if (err) {
> pr_err("%s: gpio_request failed: %d\n", __func__, err);
> return err;
> }
>
> gpio_direction_output(en_vdd_1v05, 1);
>
> regulator = regulator_get(NULL, "vdd_ldo0,vddio_pex_clk");
> if (IS_ERR_OR_NULL(regulator)) {
> pr_err("%s: regulator_get failed: %d\n", __func__,
> (int)PTR_ERR(regulator));
> goto err_reg;
> }
> ...
> err_reg:
> gpio_free(en_vdd_1v05);
>
> return err;
> }
>
> So 'err' here is never set. when IS_ERR_OR_NULL evaluates true.
> Setting 'err' to PTR_ERR(regulator) is not correct because a NULL return
> sets 'err' to zero.

FWIW, this one is fixed in the Tegra PCIe series I posted yesterday.

Thierry

Attachment: pgp00000.pgp
Description: PGP signature