Skip to content

Commit

Permalink
soc: imx: gpc: fix domain_index sanity check issue
Browse files Browse the repository at this point in the history
ARRAY_SIZE(imx_gpc_domains) represents all power domains supported
by different SoCs. Driver should use SoC specific of_id_data->num_domains
instead to do power domain index sanity check.
e.g. MX6Q supports two power domains while MX6SL supports three.

Fixes: 721cabf ("soc: imx: move PGC handling to a new GPC driver")
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
  • Loading branch information
Dong Aisheng authored and Shawn Guo committed Mar 24, 2017
1 parent 3a317f5 commit 15c3de4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/soc/imx/gpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static int imx_gpc_probe(struct platform_device *pdev)
of_node_put(np);
return ret;
}
if (domain_index >= ARRAY_SIZE(imx_gpc_domains))
if (domain_index >= of_id_data->num_domains)
continue;

domain = &imx_gpc_domains[domain_index];
Expand Down

0 comments on commit 15c3de4

Please sign in to comment.