Skip to content

Commit 76c5084

Browse files
JordanYatesnashif
authored andcommitted
sensor: current_amp: fix incorrect PM error
Returning `-ENOTSUP` (and logging a `LOG_ERR`) is not the correct behaviour if there is no enable GPIO. The fact there was no work to do does not make the result an error. From the docs for `pm_device_runtime_get` ``` * @RetVal 0 If it succeeds. In case device runtime PM is not enabled or * not available this function will be a no-op and will also return 0. ``` Signed-off-by: Jordan Yates <[email protected]>
1 parent ff3284f commit 76c5084

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/sensor/current_amp/current_amp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ static int pm_action(const struct device *dev, enum pm_device_action action)
124124
int ret;
125125

126126
if (config->power_gpio.port == NULL) {
127-
LOG_ERR("PM not supported");
128-
return -ENOTSUP;
127+
return 0;
129128
}
130129

131130
switch (action) {

0 commit comments

Comments
 (0)