diff mbox

soc: mediatek: fix the mistaken pointer accessed when subdomains are added

Message ID 9d9d75250bf62b491294a0c550c35ab7aba05eef.1518113047.git.sean.wang@mediatek.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Sean Wang Feb. 8, 2018, 6:07 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

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>
---
 drivers/soc/mediatek/mtk-scpsys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Wang March 7, 2018, 9:21 a.m. UTC | #1
Hi, Matthis
	
also a gentle ping for the patch
	
	Sean

On Fri, 2018-02-09 at 02:07 +0800, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> 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>
> ---
>  drivers/soc/mediatek/mtk-scpsys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index fc55faa..9de801e 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -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))
Matthias Brugger March 11, 2018, 10:51 p.m. UTC | #2
On 02/08/2018 07:07 PM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> 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>

Pushed now to v4.16-next/soc

Thanks a lot

@stable this would need to be applied since v4.13

> ---
>  drivers/soc/mediatek/mtk-scpsys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
> index fc55faa..9de801e 100644
> --- a/drivers/soc/mediatek/mtk-scpsys.c
> +++ b/drivers/soc/mediatek/mtk-scpsys.c
> @@ -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))
>
diff mbox

Patch

diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c
index fc55faa..9de801e 100644
--- a/drivers/soc/mediatek/mtk-scpsys.c
+++ b/drivers/soc/mediatek/mtk-scpsys.c
@@ -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))