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]
Date:   Sat, 15 Jan 2022 13:06:26 +0000
From:   Jonathan Cameron <jic23@...23.retrosnub.co.uk>
To:     Caleb Connolly <caleb.connolly@...aro.org>
Cc:     Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Lee Jones <lee.jones@...aro.org>, linux-iio@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, sumit.semwal@...aro.org,
        amit.pundir@...aro.org, john.stultz@...aro.org
Subject: Re: [PATCH v3 1/7] mfd: qcom-spmi-pmic: expose the PMIC revid
 information to clients

On Mon, 10 Jan 2022 11:46:39 +0000
Caleb Connolly <caleb.connolly@...aro.org> wrote:

> On 09/01/2022 16:57, Jonathan Cameron wrote:
> > On Thu,  6 Jan 2022 17:31:25 +0000
> > Caleb Connolly <caleb.connolly@...aro.org> wrote:
> >   
> >> Some PMIC functions such as the RRADC need to be aware of the PMIC
> >> chip revision information to implement errata or otherwise adjust
> >> behaviour, export the PMIC information to enable this.
> >>
> >> This is specifically required to enable the RRADC to adjust
> >> coefficients based on which chip fab the PMIC was produced in,
> >> this can vary per unique device and therefore has to be read at
> >> runtime.
> >>
> >> Signed-off-by: Caleb Connolly <caleb.connolly@...aro.org>  
> > Hi Caleb,
> > 
> > Some comments inline.  
> Hi Jonathan,
> 
> Thanks for the feedback, I had a question about one of your points below.

Miss read on my part.


> >>   
> >>   static const struct regmap_config spmi_regmap_config = {
> >> @@ -144,22 +122,38 @@ static const struct regmap_config spmi_regmap_config = {
> >>   static int pmic_spmi_probe(struct spmi_device *sdev)
> >>   {
> >>   	struct regmap *regmap;
> >> +	struct qcom_spmi_pmic *pmic;
> >>   
> >>   	regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config);
> >>   	if (IS_ERR(regmap))
> >>   		return PTR_ERR(regmap);
> >>   
> >> +	pmic = devm_kzalloc(&sdev->dev, sizeof(*pmic), GFP_KERNEL);
> >> +	if (!pmic)
> >> +		return -ENOMEM;  
> > 
> > Within the code visible here, why can't this just be on the stack?  
> I allocated on the heap beacuse the data has to be read by other drivers 
> (it's handed over in spmi_device_set_drvdata() below). I don't have a 
> whole lot of C experience so please forgive the potentially ignorant 
> questions - is it ok to allocate on the stack if the object needs to 
> have a lifetime longer than the function?

You are of course correct. I just missed the set_drvdata call when reading this
and thought it was just being used for the print!  Oops.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ