usb: xhci: tegra: fix coverity issues
Ajay Gupta [Mon, 22 Jul 2013 16:14:33 +0000 (09:14 -0700)]
Bug 1329327

Change-Id: Ic4e99f32972e4cb33730f8f898d6af5d07442e8a
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: http://git-master/r/251999
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>

drivers/usb/host/xhci-tegra.c
drivers/usb/host/xhci-tegra.h

index b217f62..e134d8d 100644 (file)
@@ -1456,7 +1456,7 @@ static void tegra_xhci_save_dfe_ctle_context(struct tegra_xhci_hcd *tegra,
 
        xhci_info(xhci, "saving dfe_cntl and ctle context for port %d\n", port);
 
-       if (port == 3 /* SATA pad */)
+       if (port == XUSB_SS_PORT_SATA /* SATA pad */)
                offset = padregs->iophy_misc_pad_s0_ctl6_0;
        else
                offset = port ? padregs->iophy_misc_pad_p1_ctl6_0 :
@@ -1512,7 +1512,7 @@ static void tegra_xhci_restore_dfe_ctle_context(struct tegra_xhci_hcd *tegra,
        if (tegra->dfe_ctle_ctx_saved == false)
                return;
 
-       if (port == 3 /* SATA pad */) {
+       if (port == XUSB_SS_PORT_SATA /* SATA pad */) {
                ctl4_offset = padregs->iophy_misc_pad_s0_ctl4_0;
                ctl2_offset = padregs->iophy_misc_pad_s0_ctl2_0;
        } else {
@@ -1702,7 +1702,7 @@ static void tegra_xhci_program_ss_pad(struct tegra_xhci_hcd *tegra,
        /* SATA also if USB3_SS port1 mapped to it */
        if ((port == 1) && (XUSB_DEVICE_ID_T114 != tegra->device_id) &&
                        (tegra->bdata->lane_owner & BIT(0)))
-               tegra_xhci_restore_dfe_ctle_context(tegra, 3);
+               tegra_xhci_restore_dfe_ctle_context(tegra, XUSB_SS_PORT_SATA);
 }
 
 /* This function assigns the USB ports to the controllers,
@@ -2709,8 +2709,10 @@ tegra_xhci_process_mbox_message(struct work_struct *work)
                if (tegra->cmd_data == 0x1 &&
                        XUSB_DEVICE_ID_T114 != tegra->device_id &&
                                tegra->bdata->lane_owner & BIT(0)) {
-                       tegra_xhci_save_dfe_ctle_context(tegra, 3);
-                       tegra_xhci_restore_dfe_ctle_context(tegra, 3);
+                       tegra_xhci_save_dfe_ctle_context(tegra,
+                                       XUSB_SS_PORT_SATA);
+                       tegra_xhci_restore_dfe_ctle_context(tegra,
+                                       XUSB_SS_PORT_SATA);
                }
 
                sw_resp |= tegra->cmd_data | (MBOX_CMD_ACK << MBOX_CMD_SHIFT);
index 6670371..0cc496f 100644 (file)
 #define SS_PORT_MAP_0                          0x14
 #define PORT0_MAP(x)                           (((x) & 0x7) << 0)
 #define PORT1_MAP(x)                           (((x) & 0x7) << 4)
+#define XUSB_SS_PORT_SATA                      2
 
 #define OC_DET_0                                                       0x18
 #define SET_OC_DETECTED0                                       (1 << 0)