aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libsas/sas_expander.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libsas/sas_expander.c')
-rw-r--r--drivers/scsi/libsas/sas_expander.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
index b500f0c1449c..8727436b222d 100644
--- a/drivers/scsi/libsas/sas_expander.c
+++ b/drivers/scsi/libsas/sas_expander.c
@@ -507,14 +507,21 @@ static int sas_dev_present_in_domain(struct asd_sas_port *port,
507int sas_smp_get_phy_events(struct sas_phy *phy) 507int sas_smp_get_phy_events(struct sas_phy *phy)
508{ 508{
509 int res; 509 int res;
510 u8 *req;
511 u8 *resp;
510 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent); 512 struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
511 struct domain_device *dev = sas_find_dev_by_rphy(rphy); 513 struct domain_device *dev = sas_find_dev_by_rphy(rphy);
512 u8 *req = alloc_smp_req(RPEL_REQ_SIZE);
513 u8 *resp = kzalloc(RPEL_RESP_SIZE, GFP_KERNEL);
514 514
515 if (!resp) 515 req = alloc_smp_req(RPEL_REQ_SIZE);
516 if (!req)
516 return -ENOMEM; 517 return -ENOMEM;
517 518
519 resp = alloc_smp_resp(RPEL_RESP_SIZE);
520 if (!resp) {
521 kfree(req);
522 return -ENOMEM;
523 }
524
518 req[1] = SMP_REPORT_PHY_ERR_LOG; 525 req[1] = SMP_REPORT_PHY_ERR_LOG;
519 req[9] = phy->number; 526 req[9] = phy->number;
520 527
@@ -1879,7 +1886,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1879 struct request *req) 1886 struct request *req)
1880{ 1887{
1881 struct domain_device *dev; 1888 struct domain_device *dev;
1882 int ret, type = rphy->identify.device_type; 1889 int ret, type;
1883 struct request *rsp = req->next_rq; 1890 struct request *rsp = req->next_rq;
1884 1891
1885 if (!rsp) { 1892 if (!rsp) {
@@ -1888,12 +1895,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
1888 return -EINVAL; 1895 return -EINVAL;
1889 } 1896 }
1890 1897
1891 /* seems aic94xx doesn't support */ 1898 /* no rphy means no smp target support (ie aic94xx host) */
1892 if (!rphy) { 1899 if (!rphy) {
1893 printk("%s: can we send a smp request to a host?\n", 1900 printk("%s: can we send a smp request to a host?\n",
1894 __FUNCTION__); 1901 __FUNCTION__);
1895 return -EINVAL; 1902 return -EINVAL;
1896 } 1903 }
1904 type = rphy->identify.device_type;
1897 1905
1898 if (type != SAS_EDGE_EXPANDER_DEVICE && 1906 if (type != SAS_EDGE_EXPANDER_DEVICE &&
1899 type != SAS_FANOUT_EXPANDER_DEVICE) { 1907 type != SAS_FANOUT_EXPANDER_DEVICE) {