[PATCH 04/11] discover: Fix dead code in udev_handle_cdrom_events()

Samuel Mendoza-Jonas sam.mj at au1.ibm.com
Thu Nov 12 15:34:34 AEDT 2015


The check against ddev->mounted to cause an eject action is logically
impossible. Change it so a cdrom_eject() is called properly.
Change the return value to 'true' for any action caused by
DISK_EJECT_REQUEST - no further action is appropriate in this case

Signed-off-by: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
---
 discover/udev.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/discover/udev.c b/discover/udev.c
index 6cc718e..fe3b21e 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -250,22 +250,17 @@ static bool udev_handle_cdrom_events(struct pb_udev *udev,
 
 	/* handle CDROM eject requests */
 	if (udev_device_get_property_value(dev, "DISK_EJECT_REQUEST")) {
-		bool eject = false;
-
 		pb_debug("udev: eject request\n");
 
 		/* If the device is mounted, cdrom_id's own eject request may
 		 * have failed. So, we'll need to do our own here.
 		 */
 		if (ddev) {
-			eject = ddev->mounted;
+			if (ddev->mounted)
+				cdrom_eject(node);
 			udev_handle_dev_remove(udev, dev);
-			return false;
 		}
 
-		if (eject)
-			cdrom_eject(node);
-
 		return true;
 	}
 
-- 
2.6.2



More information about the Petitboot mailing list