Skip to content

Commit

Permalink
regulator: Fix regression due to NULL constraints check
Browse files Browse the repository at this point in the history
The commit [39f802d: 'regulator: Build sysfs entries with static
attribute groups'] converted the sysfs entry creation to static
attribute groups, but this resulted in a regression due to the NULL
check of rdev->constraints.  At the point where the device is
registered, rdev->constraints isn't set, so the attributes depending
on it are missing.

We may fix it by shuffling the code order in regulator_register(), but
a quicker fix is to just remove this NULL check.  rdev->constraints is
in anyway always set to non-NULL in set_machine_constraints(), thus
the check there is basically superfluous.

Fixes: 39f802d ('regulator: Build sysfs entries with static attribute groups')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reportded-by: Steve Twiss <stwiss.opensource@diasemi.com>
Tested-by: Steve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Takashi Iwai authored and Mark Brown committed Mar 4, 2015
1 parent c517d83 commit cde72cc
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3444,13 +3444,6 @@ static umode_t regulator_attr_is_visible(struct kobject *kobj,
if (attr == &dev_attr_requested_microamps.attr)
return rdev->desc->type == REGULATOR_CURRENT ? mode : 0;

/* all the other attributes exist to support constraints;
* don't show them if there are no constraints, or if the
* relevant supporting methods are missing.
*/
if (!rdev->constraints)
return 0;

/* constraints need specific supporting methods */
if (attr == &dev_attr_min_microvolts.attr ||
attr == &dev_attr_max_microvolts.attr)
Expand Down

0 comments on commit cde72cc

Please sign in to comment.