]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind-core: drop unneeded check for NULL
authorDavid Tardon <dtardon@redhat.com>
Fri, 21 Apr 2023 08:44:43 +0000 (10:44 +0200)
committerDavid Tardon <dtardon@redhat.com>
Thu, 27 Apr 2023 19:42:38 +0000 (21:42 +0200)
src/login/logind-core.c

index 8e1c54dbe2074d2e08ccbf62624a6fe90bfa4f3b..dd4b246893c132bebae05e7f5c8c2caa59c020da 100644 (file)
@@ -323,15 +323,11 @@ int manager_process_button_device(Manager *m, sd_device *d) {
                 return r;
 
         if (device_for_action(d, SD_DEVICE_REMOVE) ||
-            sd_device_has_current_tag(d, "power-switch") <= 0) {
+            sd_device_has_current_tag(d, "power-switch") <= 0)
 
-                b = hashmap_get(m->buttons, sysname);
-                if (!b)
-                        return 0;
-
-                button_free(b);
+                button_free(hashmap_get(m->buttons, sysname));
 
-        else {
+        else {
                 const char *sn;
 
                 r = manager_add_button(m, sysname, &b);