[SCSI] SCSI core kmalloc2kzalloc
[safe/jmp/linux-2.6] / drivers / scsi / scsi_transport_sas.c
index fb6641b..2055429 100644 (file)
@@ -377,7 +377,7 @@ static void sas_phy_release(struct device *dev)
 /**
  * sas_phy_alloc  --  allocates and initialize a SAS PHY structure
  * @parent:    Parent device
- * @number:    Port number
+ * @number:    Phy index
  *
  * Allocates an SAS PHY structure.  It will be added in the device tree
  * below the device specified by @parent, which has to be either a Scsi_Host
@@ -391,10 +391,9 @@ struct sas_phy *sas_phy_alloc(struct device *parent, int number)
        struct Scsi_Host *shost = dev_to_shost(parent);
        struct sas_phy *phy;
 
-       phy = kmalloc(sizeof(*phy), GFP_KERNEL);
+       phy = kzalloc(sizeof(*phy), GFP_KERNEL);
        if (!phy)
                return NULL;
-       memset(phy, 0, sizeof(*phy));
 
        get_device(parent);
 
@@ -585,18 +584,17 @@ struct sas_rphy *sas_rphy_alloc(struct sas_phy *parent)
        struct Scsi_Host *shost = dev_to_shost(&parent->dev);
        struct sas_rphy *rphy;
 
-       rphy = kmalloc(sizeof(*rphy), GFP_KERNEL);
+       rphy = kzalloc(sizeof(*rphy), GFP_KERNEL);
        if (!rphy) {
                put_device(&parent->dev);
                return NULL;
        }
-       memset(rphy, 0, sizeof(*rphy));
 
        device_initialize(&rphy->dev);
        rphy->dev.parent = get_device(&parent->dev);
        rphy->dev.release = sas_rphy_release;
-       sprintf(rphy->dev.bus_id, "rphy-%d:%d",
-               shost->host_no, parent->number);
+       sprintf(rphy->dev.bus_id, "rphy-%d:%d-%d",
+               shost->host_no, parent->port_identifier, parent->number);
        transport_setup_device(&rphy->dev);
 
        return rphy;
@@ -638,7 +636,7 @@ int sas_rphy_add(struct sas_rphy *rphy)
        mutex_unlock(&sas_host->lock);
 
        if (rphy->scsi_target_id != -1) {
-               scsi_scan_target(&rphy->dev, parent->number,
+               scsi_scan_target(&rphy->dev, parent->port_identifier,
                                rphy->scsi_target_id, ~0, 0);
        }
 
@@ -745,9 +743,9 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel,
                if (rphy->scsi_target_id == -1)
                        continue;
 
-               if ((channel == SCAN_WILD_CARD || channel == parent->number) &&
+               if ((channel == SCAN_WILD_CARD || channel == parent->port_identifier) &&
                    (id == SCAN_WILD_CARD || id == rphy->scsi_target_id)) {
-                       scsi_scan_target(&rphy->dev, parent->number,
+                       scsi_scan_target(&rphy->dev, parent->port_identifier,
                                         rphy->scsi_target_id, lun, 1);
                }
        }
@@ -793,10 +791,9 @@ sas_attach_transport(struct sas_function_template *ft)
        struct sas_internal *i;
        int count;
 
-       i = kmalloc(sizeof(struct sas_internal), GFP_KERNEL);
+       i = kzalloc(sizeof(struct sas_internal), GFP_KERNEL);
        if (!i)
                return NULL;
-       memset(i, 0, sizeof(struct sas_internal));
 
        i->t.user_scan = sas_user_scan;