Messages in this thread | | | Subject | Re: [PATCH RESEND] regulator: rn5t618: add RC5T619 PMIC support | From | Leonard Crestez <> | Date | Fri, 13 Oct 2017 19:29:41 +0300 |
| |
On Sun, 2017-08-27 at 15:58 +0200, Pierre-Hugues Husson wrote: > Extend the driver to support Ricoh RC5T619. > Support the additional regulators and slightly different voltage ranges. > > @@ -101,10 +131,7 @@ static int rn5t618_regulator_probe(struct platform_device *pdev) > config.dev = pdev->dev.parent; > config.regmap = rn5t618->regmap; > > - for (i = 0; i < RN5T618_REG_NUM; i++) { > - if (!regulators[i].name) > - continue; > - > + for (i = 0; i < num_regulators; i++) { > rdev = devm_regulator_register(&pdev->dev, > ®ulators[i], > &config);
This is wrong. The rn5t*_regulators arrays are indexed by RN5T618_* constants and can have gaps. If you remove the check for regulators[i].name then older models get errors like this:
rn5t618-regulator rn5t618-regulator: failed to register (null) regulator rn5t618-regulator: probe of rn5t618-regulator failed with error -22
Either the check needs to be kep or otherwise regulator_desc arrays should be modified. Indexing by RN5T618_* does not appear to be used so maybe just use a flat array? That would also save a few bytes of memory.
I know it's a late comment and the patch was already accepted, I just noticed that rn5t567 fails to probe while working on something else.
-- Regards, Leonard
| |