alaurie / rpms / plymouth

Forked from rpms/plymouth 4 days ago
Clone

Blame SOURCES/0004-ply-device-manager-Remove-unnecessary-subsystem-NULL.patch

01bb59
From 5a493ef808b769f4ccc4f3acc1ecf048b8e3efdc Mon Sep 17 00:00:00 2001
01bb59
From: Hans de Goede <hdegoede@redhat.com>
01bb59
Date: Mon, 28 Feb 2022 16:20:43 +0100
01bb59
Subject: [PATCH 4/6] ply-device-manager: Remove unnecessary subsystem != NULL
01bb59
 check
01bb59
01bb59
The ply-device-manager.c already assumes that the return value of
01bb59
udev_device_get_subsystem () is never NULL in many places, including
01bb59
in the condition of the "else if" just below the check which is
01bb59
being removed.
01bb59
01bb59
Remove the one lonely check for it being NULL for consistency.
01bb59
01bb59
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
01bb59
---
01bb59
 src/libply-splash-core/ply-device-manager.c | 2 +-
01bb59
 1 file changed, 1 insertion(+), 1 deletion(-)
01bb59
01bb59
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
01bb59
index 015bd70..6b7ccd6 100644
01bb59
--- a/src/libply-splash-core/ply-device-manager.c
01bb59
+++ b/src/libply-splash-core/ply-device-manager.c
01bb59
@@ -286,61 +286,61 @@ verify_drm_device (struct udev_device *device)
01bb59
          */
01bb59
         if (ply_kernel_command_line_has_argument ("nomodeset"))
01bb59
                 return true;
01bb59
 
01bb59
         /*
01bb59
          * Some firmwares leave the panel black at boot. Allow enabling SimpleDRM
01bb59
          * use from the cmdline to show something to the user ASAP.
01bb59
          */
01bb59
         if (ply_kernel_command_line_has_argument ("plymouth.use-simpledrm"))
01bb59
                 return true;
01bb59
 
01bb59
         return false;
01bb59
 }
01bb59
 
01bb59
 static bool
01bb59
 create_devices_for_udev_device (ply_device_manager_t *manager,
01bb59
                                 struct udev_device   *device)
01bb59
 {
01bb59
         const char *device_path;
01bb59
         bool created = false;
01bb59
 
01bb59
         device_path = udev_device_get_devnode (device);
01bb59
 
01bb59
         if (device_path != NULL) {
01bb59
                 const char *subsystem;
01bb59
                 ply_renderer_type_t renderer_type = PLY_RENDERER_TYPE_NONE;
01bb59
 
01bb59
                 subsystem = udev_device_get_subsystem (device);
01bb59
                 ply_trace ("device subsystem is %s", subsystem);
01bb59
 
01bb59
-                if (subsystem != NULL && strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
01bb59
+                if (strcmp (subsystem, SUBSYSTEM_DRM) == 0) {
01bb59
                         ply_trace ("found DRM device %s", device_path);
01bb59
                         renderer_type = PLY_RENDERER_TYPE_DRM;
01bb59
                 } else if (strcmp (subsystem, SUBSYSTEM_FRAME_BUFFER) == 0) {
01bb59
                         ply_trace ("found frame buffer device %s", device_path);
01bb59
                         if (!fb_device_has_drm_device (manager, device))
01bb59
                                 renderer_type = PLY_RENDERER_TYPE_FRAME_BUFFER;
01bb59
                         else
01bb59
                                 ply_trace ("ignoring, since there's a DRM device associated with it");
01bb59
                 }
01bb59
 
01bb59
                 if (renderer_type != PLY_RENDERER_TYPE_NONE) {
01bb59
                         ply_terminal_t *terminal = NULL;
01bb59
 
01bb59
                         if (!manager->local_console_managed) {
01bb59
                                 terminal = manager->local_console_terminal;
01bb59
                         }
01bb59
 
01bb59
                         created = create_devices_for_terminal_and_renderer_type (manager,
01bb59
                                                                                  device_path,
01bb59
                                                                                  terminal,
01bb59
                                                                                  renderer_type);
01bb59
                         if (created) {
01bb59
                                 if (renderer_type == PLY_RENDERER_TYPE_DRM)
01bb59
                                         manager->found_drm_device = 1;
01bb59
                                 if (renderer_type == PLY_RENDERER_TYPE_FRAME_BUFFER)
01bb59
                                         manager->found_fb_device = 1;
01bb59
                         }
01bb59
                 }
01bb59
         }
01bb59
 
01bb59
-- 
01bb59
2.37.0.rc1
01bb59