Linux-Samsung-soc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails
@ 2019-12-22 17:41 ` Yangtao Li
  2019-12-22 17:41   ` [PATCH v2 2/2] PM / devfreq: exynos-bus: " Yangtao Li
  2019-12-23  0:51   ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: " Chanwoo Choi
  0 siblings, 2 replies; 5+ messages in thread
From: Yangtao Li @ 2019-12-22 17:41 UTC (permalink / raw)
  To: cw00.choi, myungjoo.ham, kyungmin.park, kgene, krzk, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Yangtao Li

The probe process may fail, but the devfreq event device remains
enabled. Call devfreq_event_disable_edev on the error return path.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
v2:
-change subject
-rename lable to err_edev
-fix error path handler
---
 drivers/devfreq/rk3399_dmc.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)


diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
index 2f1027c5b647..4288745304c7 100644
--- a/drivers/devfreq/rk3399_dmc.c
+++ b/drivers/devfreq/rk3399_dmc.c
@@ -364,7 +364,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 			if (res.a0) {
 				dev_err(dev, "Failed to set dram param: %ld\n",
 					res.a0);
-				return -EINVAL;
+				ret = -EINVAL;
+				goto err_edev;
 			}
 		}
 	}
@@ -373,8 +374,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 	if (node) {
 		data->regmap_pmu = syscon_node_to_regmap(node);
 		of_node_put(node);
-		if (IS_ERR(data->regmap_pmu))
-			return PTR_ERR(data->regmap_pmu);
+		if (IS_ERR(data->regmap_pmu)) {
+			ret = PTR_ERR(data->regmap_pmu);
+			goto err_edev;
+		}
 	}
 
 	regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
@@ -392,7 +395,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 		data->odt_dis_freq = data->timing.lpddr4_odt_dis_freq;
 		break;
 	default:
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_edev;
 	};
 
 	arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0,
@@ -426,7 +430,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 	 */
 	if (dev_pm_opp_of_add_table(dev)) {
 		dev_err(dev, "Invalid operating-points in device tree.\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err_edev;
 	}
 
 	of_property_read_u32(np, "upthreshold",
@@ -466,6 +471,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
 err_free_opp:
 	dev_pm_opp_of_remove_table(&pdev->dev);
+err_edev:
+	devfreq_event_disable_edev(data->edev);
 	return ret;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] PM / devfreq: exynos-bus: Disable devfreq-event device when fails
  2019-12-22 17:41 ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails Yangtao Li
@ 2019-12-22 17:41   ` " Yangtao Li
  2019-12-23  0:47     ` Chanwoo Choi
  2019-12-23  0:51   ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: " Chanwoo Choi
  1 sibling, 1 reply; 5+ messages in thread
From: Yangtao Li @ 2019-12-22 17:41 UTC (permalink / raw)
  To: cw00.choi, myungjoo.ham, kyungmin.park, kgene, krzk, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel
  Cc: Yangtao Li

The exynos_bus_profile_init process may fail, but the devfreq event device
remains enabled. Call devfreq_event_disable_edev on the error return path.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
v2:
-change subject
-rename lable to err_edev
-add return value check
---
 drivers/devfreq/exynos-bus.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 7f5917d59072..948e9340f91c 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -335,10 +335,17 @@ static int exynos_bus_profile_init(struct exynos_bus *bus,
 	ret = exynos_bus_set_event(bus);
 	if (ret < 0) {
 		dev_err(dev, "failed to set event to devfreq-event devices\n");
-		return ret;
+		goto err_edev;
 	}
 
 	return 0;
+
+err_edev:
+	ret = exynos_bus_disable_edev(bus);
+	if (ret < 0)
+		dev_warn(dev, "failed to disable the devfreq-event devices\n");
+
+	return ret;
 }
 
 static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] PM / devfreq: exynos-bus: Disable devfreq-event device when fails
  2019-12-22 17:41   ` [PATCH v2 2/2] PM / devfreq: exynos-bus: " Yangtao Li
@ 2019-12-23  0:47     ` Chanwoo Choi
  2019-12-23  0:50       ` Chanwoo Choi
  0 siblings, 1 reply; 5+ messages in thread
From: Chanwoo Choi @ 2019-12-23  0:47 UTC (permalink / raw)
  To: Yangtao Li, myungjoo.ham, kyungmin.park, kgene, krzk, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel

On 12/23/19 2:41 AM, Yangtao Li wrote:
> The exynos_bus_profile_init process may fail, but the devfreq event device
> remains enabled. Call devfreq_event_disable_edev on the error return path.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
> v2:
> -change subject
> -rename lable to err_edev
> -add return value check
> ---
>  drivers/devfreq/exynos-bus.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 7f5917d59072..948e9340f91c 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -335,10 +335,17 @@ static int exynos_bus_profile_init(struct exynos_bus *bus,
>  	ret = exynos_bus_set_event(bus);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to set event to devfreq-event devices\n");
> -		return ret;
> +		goto err_edev;
>  	}
>  
>  	return 0;
> +
> +err_edev:
> +	ret = exynos_bus_disable_edev(bus);
> +	if (ret < 0)
> +		dev_warn(dev, "failed to disable the devfreq-event devices\n");
> +
> +	return ret;
>  }
>  
>  static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
> 

Applied it.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 2/2] PM / devfreq: exynos-bus: Disable devfreq-event device when fails
  2019-12-23  0:47     ` Chanwoo Choi
@ 2019-12-23  0:50       ` Chanwoo Choi
  0 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2019-12-23  0:50 UTC (permalink / raw)
  To: Yangtao Li, myungjoo.ham, kyungmin.park, kgene, krzk, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel

On 12/23/19 9:47 AM, Chanwoo Choi wrote:
> On 12/23/19 2:41 AM, Yangtao Li wrote:
>> The exynos_bus_profile_init process may fail, but the devfreq event device
>> remains enabled. Call devfreq_event_disable_edev on the error return path.
>>
>> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
>> ---
>> v2:
>> -change subject
>> -rename lable to err_edev
>> -add return value check
>> ---
>>  drivers/devfreq/exynos-bus.c | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
>> index 7f5917d59072..948e9340f91c 100644
>> --- a/drivers/devfreq/exynos-bus.c
>> +++ b/drivers/devfreq/exynos-bus.c
>> @@ -335,10 +335,17 @@ static int exynos_bus_profile_init(struct exynos_bus *bus,
>>  	ret = exynos_bus_set_event(bus);
>>  	if (ret < 0) {
>>  		dev_err(dev, "failed to set event to devfreq-event devices\n");
>> -		return ret;
>> +		goto err_edev;
>>  	}
>>  
>>  	return 0;
>> +
>> +err_edev:
>> +	ret = exynos_bus_disable_edev(bus);
>> +	if (ret < 0)
>> +		dev_warn(dev, "failed to disable the devfreq-event devices\n");
>> +
>> +	return ret;
>>  }
>>  
>>  static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
>>
> 
> Applied it.
> 

I'm sorry. I applied the v3[1] patch instead of this.
[1] https://patchwork.kernel.org/patch/11307721/


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails
  2019-12-22 17:41 ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails Yangtao Li
  2019-12-22 17:41   ` [PATCH v2 2/2] PM / devfreq: exynos-bus: " Yangtao Li
@ 2019-12-23  0:51   ` " Chanwoo Choi
  1 sibling, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2019-12-23  0:51 UTC (permalink / raw)
  To: Yangtao Li, myungjoo.ham, kyungmin.park, kgene, krzk, linux-pm,
	linux-samsung-soc, linux-arm-kernel, linux-kernel

On 12/23/19 2:41 AM, Yangtao Li wrote:
> The probe process may fail, but the devfreq event device remains
> enabled. Call devfreq_event_disable_edev on the error return path.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
> v2:
> -change subject
> -rename lable to err_edev
> -fix error path handler
> ---
>  drivers/devfreq/rk3399_dmc.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> 
> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
> index 2f1027c5b647..4288745304c7 100644
> --- a/drivers/devfreq/rk3399_dmc.c
> +++ b/drivers/devfreq/rk3399_dmc.c
> @@ -364,7 +364,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  			if (res.a0) {
>  				dev_err(dev, "Failed to set dram param: %ld\n",
>  					res.a0);
> -				return -EINVAL;
> +				ret = -EINVAL;
> +				goto err_edev;
>  			}
>  		}
>  	}
> @@ -373,8 +374,10 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  	if (node) {
>  		data->regmap_pmu = syscon_node_to_regmap(node);
>  		of_node_put(node);
> -		if (IS_ERR(data->regmap_pmu))
> -			return PTR_ERR(data->regmap_pmu);
> +		if (IS_ERR(data->regmap_pmu)) {
> +			ret = PTR_ERR(data->regmap_pmu);
> +			goto err_edev;
> +		}
>  	}
>  
>  	regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val);
> @@ -392,7 +395,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  		data->odt_dis_freq = data->timing.lpddr4_odt_dis_freq;
>  		break;
>  	default:
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto err_edev;
>  	};
>  
>  	arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, 0, 0,
> @@ -426,7 +430,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  	 */
>  	if (dev_pm_opp_of_add_table(dev)) {
>  		dev_err(dev, "Invalid operating-points in device tree.\n");
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto err_edev;
>  	}
>  
>  	of_property_read_u32(np, "upthreshold",
> @@ -466,6 +471,8 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  
>  err_free_opp:
>  	dev_pm_opp_of_remove_table(&pdev->dev);
> +err_edev:
> +	devfreq_event_disable_edev(data->edev);
>  	return ret;
>  }
>  
> 

Applied it.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20191222174139epcas5p2019ddf01d7c2d17020733eafa173508b@epcas5p2.samsung.com>
2019-12-22 17:41 ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails Yangtao Li
2019-12-22 17:41   ` [PATCH v2 2/2] PM / devfreq: exynos-bus: " Yangtao Li
2019-12-23  0:47     ` Chanwoo Choi
2019-12-23  0:50       ` Chanwoo Choi
2019-12-23  0:51   ` [PATCH v2 1/2] PM / devfreq: rk3399_dmc: " Chanwoo Choi

Linux-Samsung-soc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-samsung-soc/0 linux-samsung-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-samsung-soc linux-samsung-soc/ https://lore.kernel.org/linux-samsung-soc \
		linux-samsung-soc@vger.kernel.org
	public-inbox-index linux-samsung-soc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-samsung-soc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git