isci: copy the oem parameters instead of assign
authorDave Jiang <dave.jiang@intel.com>
Fri, 25 Feb 2011 01:45:57 +0000 (17:45 -0800)
committerDan Williams <dan.j.williams@intel.com>
Sun, 3 Jul 2011 10:55:30 +0000 (03:55 -0700)
Since the data structure for oem from orom/efi/firmware is the same as what
the core uses, we can just do a direct copy instead of assignment.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/scsi/isci/probe_roms.c

index 927feaddc04dc3900a950799dd23a241731ce151..8222405781151945c63d9ad92f485efeae448019 100644 (file)
@@ -92,24 +92,14 @@ struct isci_orom *isci_request_oprom(struct pci_dev *pdev)
 enum sci_status isci_parse_oem_parameters(union scic_oem_parameters *oem_params,
                                          struct isci_orom *orom, int scu_index)
 {
-       int i;
-
        /* check for valid inputs */
-       if (!(scu_index >= 0
-             && scu_index < SCI_MAX_CONTROLLERS
-             && oem_params != NULL))
+       if (scu_index < 0 || scu_index > SCI_MAX_CONTROLLERS ||
+           scu_index > orom->hdr.num_elements || !oem_params)
                return -EINVAL;
 
-       for (i = 0; i < SCI_MAX_PHYS; i++) {
-               oem_params->sds1.phys[i].sas_address.low =
-                       orom->ctrl[scu_index].phys[i].sas_address.low;
-               oem_params->sds1.phys[i].sas_address.high =
-                       orom->ctrl[scu_index].phys[i].sas_address.high;
-       }
-
-       for (i = 0; i < SCI_MAX_PORTS; i++)
-               oem_params->sds1.ports[i].phy_mask =
-                       orom->ctrl[scu_index].ports[i].phy_mask;
+       memcpy(oem_params,
+              &orom->ctrl[scu_index],
+              sizeof(struct scic_sds_oem_params));
 
        return 0;
 }