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:	Thu, 28 May 2009 21:01:26 +0200
From:	pHilipp Zabel <philipp.zabel@...il.com>
To:	Robert Jarzmik <robert.jarzmik@...e.fr>
Cc:	linux-kernel@...r.kernel.org, Liam Girdwood <lrg@...mlogic.co.uk>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Eric Miao <eric.miao@...vell.com>
Subject: Re: [PATCH 1/3] regulator/max1586: support increased V3 voltage range

On Thu, May 28, 2009 at 8:58 PM, Robert Jarzmik <robert.jarzmik@...e.fr> wrote:
> Philipp Zabel <philipp.zabel@...il.com> writes:
>
> <snip>
>> @@ -164,14 +184,25 @@ static int max1586_pmic_probe(struct i2c_client *client,
>>  {
>>       struct regulator_dev **rdev;
>>       struct max1586_platform_data *pdata = client->dev.platform_data;
>> -     int i, id, ret = 0;
>> +     struct max1586_data *max1586;
>> +     int i, id, ret = -ENOMEM;
>> +
>> +     max1586 = kzalloc(sizeof(struct max1586_data) +
>> +                     sizeof(struct regulator_dev *) * (MAX1586_V6 + 1),
>> +                     GFP_KERNEL);
>> +     if (!max1586)
>> +             goto out;
>>
>> -     rdev = kzalloc(sizeof(struct regulator_dev *) * (MAX1586_V6 + 1),
>> -                    GFP_KERNEL);
>> -     if (!rdev)
>> -             return -ENOMEM;
>> +     max1586->client = client;
>>
>> -     ret = -EINVAL;
>> +     if (!pdata->v3_gain) {
>> +             ret = -EINVAL;
>> +             goto out_unmap;
>> +     }
>
>> +     max1586->min_uV = MAX1586_V3_MIN_UV * pdata->v3_gain / 1000000;
>> +     max1586->max_uV = MAX1586_V3_MAX_UV * pdata->v3_gain / 1000000;
> My last comment : you'll overflow an integer capacity here, and will get
> min_uV=max_uV=0.
>
> Please replace by :
>       max1586->min_uV = MAX1586_V3_MIN_UV / 1000 * (pdata->v3_gain / 1000);
>       max1586->max_uV = MAX1586_V3_MAX_UV / 1000 * (pdata->v3_gain / 1000);
>
> And then add my :
> Acked-by: Robert Jarzmik <robert.jarzmik@...e.fr>

Wow, thanks. I literally sent a patch to that effect a few seconds
ago. Would you be ok with that one, too? I'd like not to lose too much
resolution in the v3_gain parameter.

regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ