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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230407184616.2fd2d52a@jic23-huawei>
Date:   Fri, 7 Apr 2023 18:46:16 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Lars-Peter Clausen <lars@...afoo.de>
Cc:     Nicolas Frattaroli <frattaroli.nicolas@...il.com>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] iio: dac: mcp4922: get and enable vdd regulator

On Wed, 5 Apr 2023 07:21:00 -0700
Lars-Peter Clausen <lars@...afoo.de> wrote:

> On 4/5/23 07:01, Nicolas Frattaroli wrote:
> > [...]
> > +	state->vdd_reg = devm_regulator_get(&spi->dev, "vdd");
> > +	if (IS_ERR(state->vdd_reg)) {
> > +		ret = dev_err_probe(&spi->dev, PTR_ERR(state->vdd_reg),
> > +				    "vdd regulator not specified\n");
> > +		goto error_disable_vref_reg;
> > +	}
> > +	ret = regulator_enable(state->vdd_reg);
> > +	if (ret) {
> > +		dev_err(&spi->dev, "Failed to enable vdd regulator: %d\n",
> > +			ret);
> > +		goto error_disable_vref_reg;
> > +	}  
> The two above can be combined into `devm_regulator_get_enable()`. This 
> will also take care of automatically disabling the regulator on the 
> error path and on remove.

I'm not keen on the ordering of probe wrt to remove that results from mixing
devm and not.   Note that already happens because of the gets vs enables
so another reason to take this driver fully devm_ based.

Jonathan


> > +
> >   	spi_set_drvdata(spi, indio_dev);
> >   	id = spi_get_device_id(spi);
> >   	indio_dev->info = &mcp4922_info;
> > [...]  
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ