diff mbox series

[v2] PM / devfreq: Check NULL governor in available_governors_show

Message ID 921db734cb5c92875c3f81250126e2027bf6144b.1569309756.git.leonard.crestez@nxp.com (mailing list archive)
State Accepted
Headers show
Series [v2] PM / devfreq: Check NULL governor in available_governors_show | expand

Commit Message

Leonard Crestez Sept. 24, 2019, 7:26 a.m. UTC
The governor is initialized after sysfs attributes become visible so in
theory the governor field can be NULL here.

Fixes: bcf23c79c4e46 ("PM / devfreq: Fix available_governor sysfs")
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/devfreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Changes since v1:
* Add Fixes tag and Reviewed-by
Link to v1: https://patchwork.kernel.org/patch/11157333/

Don't add cc: stable since it's a theoretical race condition.

Comments

Leonard Crestez Oct. 31, 2019, 2:22 p.m. UTC | #1
On 24.09.2019 10:26, Leonard Crestez wrote:
> The governor is initialized after sysfs attributes become visible so in
> theory the governor field can be NULL here.
> 
> Fixes: bcf23c79c4e46 ("PM / devfreq: Fix available_governor sysfs")
> Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
> Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>

Gentle ping?

This is a very simple bugfix with no dependencies which has already been 
reviewed. Same applies to the following patch:

https://patchwork.kernel.org/patch/11158225/

> ---
>   drivers/devfreq/devfreq.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Changes since v1:
> * Add Fixes tag and Reviewed-by
> Link to v1: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F11157333%2F&amp;data=02%7C01%7Cleonard.crestez%40nxp.com%7C857374c5be41480ec9ad08d740c09549%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637049068194432556&amp;sdata=BIV9uq2WOBIrDLwGBWiM2wvHPselZnqdtOUV1uzzBsQ%3D&amp;reserved=0
> 
> Don't add cc: stable since it's a theoretical race condition.
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index b905963cea7d..60859a2400bc 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -1193,11 +1193,11 @@ static ssize_t available_governors_show(struct device *d,
>   
>   	/*
>   	 * The devfreq with immutable governor (e.g., passive) shows
>   	 * only own governor.
>   	 */
> -	if (df->governor->immutable) {
> +	if (df->governor && df->governor->immutable) {
>   		count = scnprintf(&buf[count], DEVFREQ_NAME_LEN,
>   				  "%s ", df->governor_name);
>   	/*
>   	 * The devfreq device shows the registered governor except for
>   	 * immutable governors such as passive governor .
>
diff mbox series

Patch

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index b905963cea7d..60859a2400bc 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1193,11 +1193,11 @@  static ssize_t available_governors_show(struct device *d,
 
 	/*
 	 * The devfreq with immutable governor (e.g., passive) shows
 	 * only own governor.
 	 */
-	if (df->governor->immutable) {
+	if (df->governor && df->governor->immutable) {
 		count = scnprintf(&buf[count], DEVFREQ_NAME_LEN,
 				  "%s ", df->governor_name);
 	/*
 	 * The devfreq device shows the registered governor except for
 	 * immutable governors such as passive governor .