summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchal Verma <achalv@nvidia.com>2021-05-12 07:32:26 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2021-08-13 16:10:34 -0400
commitacf8657b4c03ad6a74c79924baf7247a11aa0a51 (patch)
treebd467c55bca5c343d02c71860e5845098f4eb0fd
parent3b96cf0548080dc298fcb380ddef155545c53a1a (diff)
ahci: Fix potential NULL ptr dereference.
This fixes coverity issue: 20360 Bug 200741055 Change-Id: I6bfdaf58b4d7d03a3c4edde6c229e9c1bc4164f7 Signed-off-by: Achal Verma <achalv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2528439 Tested-by: Rahul Jain (SW-TEGRA) <rahuljain@nvidia.com> Reviewed-by: Rahul Jain (SW-TEGRA) <rahuljain@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2575305 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
-rw-r--r--drivers/ata/tegra/ahci_tegra.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/ata/tegra/ahci_tegra.c b/drivers/ata/tegra/ahci_tegra.c
index cd2602a59..9033e8324 100644
--- a/drivers/ata/tegra/ahci_tegra.c
+++ b/drivers/ata/tegra/ahci_tegra.c
@@ -1412,16 +1412,25 @@ static int tegra_ahci_disable_features(struct ahci_host_priv *hpriv)
1412static int tegra_ahci_quirks(struct ahci_host_priv *hpriv) 1412static int tegra_ahci_quirks(struct ahci_host_priv *hpriv)
1413{ 1413{
1414 struct tegra_ahci_priv *tegra = hpriv->plat_data; 1414 struct tegra_ahci_priv *tegra = hpriv->plat_data;
1415 struct platform_device *pdev = tegra->pdev; 1415 struct platform_device *pdev;
1416 struct device *dev = &pdev->dev; 1416 struct device *dev;
1417 u32 t_satao_nvoob_comma_cnt_mask = 1417 u32 t_satao_nvoob_comma_cnt_mask;
1418 tegra->soc_data->reg.t_satao_nvoob_comma_cnt_mask; 1418 u32 t_satao_nvoob_comma_cnt;
1419 u32 t_satao_nvoob_comma_cnt =
1420 tegra->soc_data->reg.t_satao_nvoob_comma_cnt;
1421 unsigned int val; 1419 unsigned int val;
1422 unsigned int mask; 1420 unsigned int mask;
1423 int ret = 0; 1421 int ret = 0;
1424 1422
1423 if (tegra) {
1424 pdev = tegra->pdev;
1425 dev = &pdev->dev;
1426 t_satao_nvoob_comma_cnt_mask =
1427 tegra->soc_data->reg.t_satao_nvoob_comma_cnt_mask;
1428 t_satao_nvoob_comma_cnt =
1429 tegra->soc_data->reg.t_satao_nvoob_comma_cnt;
1430 } else {
1431 return -ENODEV;
1432 }
1433
1425 /* SATA WARS */ 1434 /* SATA WARS */
1426 /* For SQUELCH Filter & Gen3 drive getting detected as Gen1 drive */ 1435 /* For SQUELCH Filter & Gen3 drive getting detected as Gen1 drive */
1427 1436
@@ -1443,7 +1452,7 @@ static int tegra_ahci_quirks(struct ahci_host_priv *hpriv)
1443 val = T_SATA0_CFG2NVOOB_2_COMWAKE_IDLE_CNT_LOW; 1452 val = T_SATA0_CFG2NVOOB_2_COMWAKE_IDLE_CNT_LOW;
1444 tegra_ahci_scfg_update(hpriv, val, mask, T_SATA0_CFG2NVOOB_2); 1453 tegra_ahci_scfg_update(hpriv, val, mask, T_SATA0_CFG2NVOOB_2);
1445 1454
1446 if (tegra && tegra->prod_list) { 1455 if (tegra->prod_list) {
1447 tegra_ahci_scfg_writel(hpriv, T_SATA0_INDEX_CH1, T_SATA0_INDEX); 1456 tegra_ahci_scfg_writel(hpriv, T_SATA0_INDEX_CH1, T_SATA0_INDEX);
1448 ret = tegra_prod_set_by_name(tegra->base_list, "prod", 1457 ret = tegra_prod_set_by_name(tegra->base_list, "prod",
1449 tegra->prod_list); 1458 tegra->prod_list);