[PATCH 04/11] discover: Fix dead code in udev_handle_cdrom_events()
Sam Mendoza-Jonas
sam.mj at au1.ibm.com
Fri Dec 18 10:43:02 AEDT 2015
On Thu, Nov 12, 2015 at 03:34:34PM +1100, Samuel Mendoza-Jonas wrote:
> 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;
On review the eject should happen *after* the call to
udev_handle_dev_remove so we properly unmount everything first. I'll
fix this up before merging.
> }
>
> - if (eject)
> - cdrom_eject(node);
> -
> return true;
> }
>
> --
> 2.6.2
>
More information about the Petitboot
mailing list