[SCSI] libsas: better error handling in sas_ex_discover_end_dev()
This replaces a few BUG_ON() statements with the correct failure error
handling. There are still many more to do.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index 0746487..d05fc23 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -670,8 +670,8 @@
sizeof(struct dev_to_host_fis));
rphy = sas_end_device_alloc(phy->port);
- /* FIXME: error handling */
- BUG_ON(!rphy);
+ if (unlikely(!rphy))
+ goto out_free;
sas_init_dev(child);