regulator: Check for constraints before using them for name

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
This commit is contained in:
Mark Brown 2009-08-03 18:49:54 +01:00 committed by Liam Girdwood
parent c53ad7fe57
commit b39480ac37
1 changed files with 1 additions and 1 deletions

View File

@ -232,7 +232,7 @@ static ssize_t regulator_name_show(struct device *dev,
struct regulator_dev *rdev = dev_get_drvdata(dev);
const char *name;
if (rdev->constraints->name)
if (rdev->constraints && rdev->constraints->name)
name = rdev->constraints->name;
else if (rdev->desc->name)
name = rdev->desc->name;