diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index d225671..28c8cdf 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -690,91 +690,52 @@
 	return 0;
 }
 
-/*
- * Delete an efi_disk object for a whole raw disk
+/**
+ * efi_disk_remove - delete an efi_disk object for a block device or partition
  *
- * @dev		uclass device (UCLASS_BLK)
+ * @ctx:	event context: driver binding protocol
+ * @event:	EV_PM_PRE_REMOVE event
  *
- * Delete an efi_disk object which is associated with @dev.
- * The type of @dev must be UCLASS_BLK.
+ * Delete an efi_disk object which is associated with the UCLASS_BLK or
+ * UCLASS_PARTITION device for which the EV_PM_PRE_REMOVE event is raised.
  *
- * @return	0 on success, -1 otherwise
+ * Return:	0 on success, -1 otherwise
  */
-static int efi_disk_delete_raw(struct udevice *dev)
+int efi_disk_remove(void *ctx, struct event *event)
 {
+	enum uclass_id id;
+	struct udevice *dev = event->data.dm.dev;
 	efi_handle_t handle;
 	struct blk_desc *desc;
-	struct efi_disk_obj *diskobj;
+	struct efi_disk_obj *diskobj = NULL;
 
 	if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle))
-		return -1;
+		return 0;
 
-	desc = dev_get_uclass_plat(dev);
-	if (desc->uclass_id != UCLASS_EFI_LOADER) {
+	id = device_get_uclass_id(dev);
+	switch (id) {
+	case UCLASS_BLK:
+		desc = dev_get_uclass_plat(dev);
+		if (desc && desc->uclass_id != UCLASS_EFI_LOADER)
+			diskobj = container_of(handle, struct efi_disk_obj,
+					       header);
+		break;
+	case UCLASS_PARTITION:
 		diskobj = container_of(handle, struct efi_disk_obj, header);
-		efi_free_pool(diskobj->dp);
+		break;
+	default:
+		return 0;
 	}
 
-	efi_delete_handle(handle);
-	dev_tag_del(dev, DM_TAG_EFI);
-
-	return 0;
-}
-
-/*
- * Delete an efi_disk object for a disk partition
- *
- * @dev		uclass device (UCLASS_PARTITION)
- *
- * Delete an efi_disk object which is associated with @dev.
- * The type of @dev must be UCLASS_PARTITION.
- *
- * @return	0 on success, -1 otherwise
- */
-static int efi_disk_delete_part(struct udevice *dev)
-{
-	efi_handle_t handle;
-	struct efi_disk_obj *diskobj;
-
-	if (dev_tag_get_ptr(dev, DM_TAG_EFI, (void **)&handle))
-		return -1;
-
-	diskobj = container_of(handle, struct efi_disk_obj, header);
+	if (diskobj)
+		efi_free_pool(diskobj->dp);
 
-	efi_free_pool(diskobj->dp);
 	efi_delete_handle(handle);
 	dev_tag_del(dev, DM_TAG_EFI);
 
 	return 0;
 }
 
-/*
- * Delete an efi_disk object for a block device
- *
- * @dev		uclass device (UCLASS_BLK or UCLASS_PARTITION)
- *
- * Delete an efi_disk object which is associated with @dev.
- * The type of @dev must be either UCLASS_BLK or UCLASS_PARTITION.
- * This function is expected to be called at EV_PM_PRE_REMOVE.
- *
- * @return	0 on success, -1 otherwise
- */
-int efi_disk_remove(void *ctx, struct event *event)
-{
-	enum uclass_id id;
-	struct udevice *dev;
-
-	dev = event->data.dm.dev;
-	id = device_get_uclass_id(dev);
-
-	if (id == UCLASS_BLK)
-		return efi_disk_delete_raw(dev);
-	else if (id == UCLASS_PARTITION)
-		return efi_disk_delete_part(dev);
-	else
-		return 0;
-}
-
 /**
  * efi_disk_get_device_name() - get U-Boot device name associated with EFI handle
  *
