Skip to content

Commit edfa075

Browse files
broonierobherring
authored andcommitted
drm/panfrost: Fix regulator_get_optional() misuse
The panfrost driver requests a supply using regulator_get_optional() but both the name of the supply and the usage pattern suggest that it is being used for the main power for the device and is not at all optional for the device for function, there is no meaningful handling for absent supplies. Such regulators should use the vanilla regulator_get() interface, it will ensure that even if a supply is not described in the system integration one will be provided in software. Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Rob Herring <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d4da4e3 commit edfa075

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/gpu/drm/panfrost/panfrost_device.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,9 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
8989
{
9090
int ret;
9191

92-
pfdev->regulator = devm_regulator_get_optional(pfdev->dev, "mali");
92+
pfdev->regulator = devm_regulator_get(pfdev->dev, "mali");
9393
if (IS_ERR(pfdev->regulator)) {
9494
ret = PTR_ERR(pfdev->regulator);
95-
pfdev->regulator = NULL;
96-
if (ret == -ENODEV)
97-
return 0;
9895
dev_err(pfdev->dev, "failed to get regulator: %d\n", ret);
9996
return ret;
10097
}
@@ -110,8 +107,7 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
110107

111108
static void panfrost_regulator_fini(struct panfrost_device *pfdev)
112109
{
113-
if (pfdev->regulator)
114-
regulator_disable(pfdev->regulator);
110+
regulator_disable(pfdev->regulator);
115111
}
116112

117113
int panfrost_device_init(struct panfrost_device *pfdev)

0 commit comments

Comments
 (0)