soc: mediatek: fix the mistaken pointer accessed when subdomains are added
authorSean Wang <sean.wang@mediatek.com>
Thu, 8 Feb 2018 18:07:59 +0000 (02:07 +0800)
committerMatthias Brugger <matthias.bgg@gmail.com>
Sun, 11 Mar 2018 22:46:50 +0000 (23:46 +0100)
Fix the pointer to struct scp_subdomian not being moved forward
when each sub-domain is expected to be iteratively added through
pm_genpd_add_subdomain call.

Cc: stable@vger.kernel.org
Fixes: 53fddb1a66dd ("soc: mediatek: reduce code duplication of scpsys_probe across all SoCs")
Reported-by: Weiyi Lu <weiyi.lu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
drivers/soc/mediatek/mtk-scpsys.c

index fc55faa178673a8b144d9d5c3536af97cd8d5160..9de801e9e0e0bde73f9305ab7bed327081dd0d2d 100644 (file)
@@ -1048,7 +1048,7 @@ static int scpsys_probe(struct platform_device *pdev)
 
        pd_data = &scp->pd_data;
 
-       for (i = 0, sd = soc->subdomains ; i < soc->num_subdomains ; i++) {
+       for (i = 0, sd = soc->subdomains; i < soc->num_subdomains; i++, sd++) {
                ret = pm_genpd_add_subdomain(pd_data->domains[sd->origin],
                                             pd_data->domains[sd->subdomain]);
                if (ret && IS_ENABLED(CONFIG_PM))