misc: mods: fix issues from Coverity

CID 368887
CID 382069
CID 490237

Bug 3512545

Change-Id: I955bb2cf14a64127cb5243d46ea964cb94ff4f2d
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2673080
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Chris Dragan
2022-02-21 01:00:13 -08:00
committed by Laxman Dewangan
parent 5335da0508
commit 4e5838f829
2 changed files with 23 additions and 9 deletions

View File

@@ -1526,21 +1526,29 @@ int esc_mods_map_irq(struct mods_client *client,
}
hwirq = oirq.args[1];
/* Get the platform device handle */
pdev = of_find_device_by_node(np);
if (of_node_cmp(p->dt_name, "watchdog") == 0) {
/* Enable and unmask interrupt for watchdog */
struct resource *res_src = platform_get_resource(pdev,
IORESOURCE_MEM, 0);
struct resource *res_tke = platform_get_resource(pdev,
IORESOURCE_MEM, 2);
void __iomem *wdt_tke = devm_ioremap(&pdev->dev,
res_tke->start, resource_size(res_tke));
int wdt_index = ((res_src->start >> 16) & 0xF) - 0xc;
struct resource *res_src =
platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct resource *res_tke =
platform_get_resource(pdev, IORESOURCE_MEM, 2);
void __iomem *wdt_tke = NULL;
int wdt_index;
writel(TOP_TKE_TKEIE_WDT_MASK(wdt_index), wdt_tke +
TOP_TKE_TKEIE(hwirq));
if (res_tke && res_src) {
wdt_tke = devm_ioremap(&pdev->dev, res_tke->start,
resource_size(res_tke));
wdt_index = ((res_src->start >> 16) & 0xF) - 0xc;
}
if (wdt_tke) {
writel(TOP_TKE_TKEIE_WDT_MASK(wdt_index),
wdt_tke + TOP_TKE_TKEIE(hwirq));
}
}
error: