mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: pHilipp Zabel <philipp.zabel@gmail.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Eric Miao <eric.miao@marvell.com>
Subject: Re: [PATCH 1/3] regulator/max1586: support increased V3 voltage range
Date: Thu, 28 May 2009 21:01:26 +0200	[thread overview]
Message-ID: <74d0deb30905281201k1eda2bcg39d2c1989533cbc8@mail.gmail.com> (raw)
In-Reply-To: <87skip2gxu.fsf@free.fr>

On Thu, May 28, 2009 at 8:58 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Philipp Zabel <philipp.zabel@gmail.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@free.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

  reply	other threads:[~2009-05-28 19:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 19:39 [PATCH] " Philipp Zabel
2009-05-26 20:43 ` Mark Brown
2009-05-26 21:26   ` pHilipp Zabel
2009-05-26 21:31 ` Robert Jarzmik
2009-05-26 23:40   ` pHilipp Zabel
2009-05-27 15:12     ` Robert Jarzmik
2009-05-28  5:15       ` Philipp Zabel
2009-05-28  5:15       ` [PATCH 1/3] regulator/max1586: support increased V3 voltage range Philipp Zabel
2009-05-28  8:59         ` Mark Brown
2009-05-28 19:00           ` [PATCH] regulator/max1586: fix V3 gain calculation integer overflow Philipp Zabel
2009-05-28 20:36             ` Robert Jarzmik
2009-05-29  9:04               ` Liam Girdwood
2009-05-28 18:58         ` [PATCH 1/3] regulator/max1586: support increased V3 voltage range Robert Jarzmik
2009-05-28 19:01           ` pHilipp Zabel [this message]
2009-05-28 20:36             ` Robert Jarzmik
2009-05-28  5:15       ` [PATCH 4/5] pxa/mioa701: add V3 gain configuration for Maxim 1586 voltage regulator Philipp Zabel
2009-05-28  5:16         ` pHilipp Zabel
2009-05-29  6:22         ` Robert Jarzmik
2009-06-01  5:39           ` Eric Miao
2009-05-28  5:15       ` [PATCH 3/3] pxa/hx4700: add Maxim 1587A " Philipp Zabel
2009-06-01  5:37         ` Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74d0deb30905281201k1eda2bcg39d2c1989533cbc8@mail.gmail.com \
    --to=philipp.zabel@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=eric.miao@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®