summaryrefslogtreecommitdiffstats
path: root/src/backlight
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-01-05 10:26:46 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2022-01-05 13:56:37 +0100
commitf0f65087834198d4dabf8b389ddc34223400aab7 (patch)
treec5498f0ed01028ba2b4983e24959caad7433e859 /src/backlight
parentMerge pull request #21974 from yuwata/test-repart-find-sfdisk (diff)
downloadsystemd-f0f65087834198d4dabf8b389ddc34223400aab7.tar.xz
systemd-f0f65087834198d4dabf8b389ddc34223400aab7.zip
backlight: ignore error if the backlight device is already removed
Fixes #21997.
Diffstat (limited to 'src/backlight')
-rw-r--r--src/backlight/backlight.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index fd92135fc7..5a3095cbba 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -395,8 +395,16 @@ static int run(int argc, char *argv[]) {
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Not a backlight or LED device: '%s:%s'", ss, sysname);
r = sd_device_new_from_subsystem_sysname(&device, ss, sysname);
- if (r < 0)
- return log_error_errno(r, "Failed to get backlight or LED device '%s:%s': %m", ss, sysname);
+ if (r < 0) {
+ bool ignore = r == -ENODEV;
+
+ /* Some drivers, e.g. for AMD GPU, removes acpi backlight device soon after it is added.
+ * See issue #21997. */
+ log_full_errno(ignore ? LOG_DEBUG : LOG_ERR, r,
+ "Failed to get backlight or LED device '%s:%s'%s: %m",
+ ss, sysname, ignore ? ", ignoring" : "");
+ return ignore ? 0 : r;
+ }
/* If max_brightness is 0, then there is no actual backlight device. This happens on desktops
* with Asus mainboards that load the eeepc-wmi module. */