powercap/drivers/dtpm: Fix a double shift bug
PATCH 1/3 powercap/drivers/dtpm: Fix a double shift bug
The DTPM_POWER_LIMIT_FLAG is used for test_bit() etc which take a bit number so it should be bit 0. But currently it's set to BIT(0) then that is double shifted equivalent to BIT(BIT(0)). This doesn't cause a run time problem because it's done consistently.
--- drivers/powercap/dtpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/dtpm.c +1 -1
@@ -24,7 +24,7 @@#include <linux/slab.h> #include <linux/mutex.h> -#define DTPM_POWER_LIMIT_FLAG BIT(0) +#define DTPM_POWER_LIMIT_FLAG 0static const char *constraint_name[] = {"Instantaneous" ,
Signature · 1 line
2.29.2
PATCH 3/3 powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
The powercap_register_control_type() function never returns NULL, it returns error pointers on error so update this check.
--- drivers/powercap/dtpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/powercap/dtpm.c +2 -2
@@ -467,9 +467,9 @@ static int __init dtpm_init(void)struct dtpm_descr **dtpm_descr; pct =powercap_register_control_type (NULL ,"dtpm" ,NULL ); -if (!pct) { +if (IS_ERR (pct)) {pr_err ("Failed to register control type\n" ); -return -EINVAL ; +return PTR_ERR (pct); }for_each_dtpm_table (dtpm_descr)
Signature · 1 line
2.29.2
Re: [PATCH 3/3] powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
Quoted 5 lines · Dan Carpenter
The
powercap_register_control_type()function never returns NULL, it returns error pointers on error so update this check.Fixes a20d0ef97abf ("powercap/drivers/dtpm: Add API for dynamic thermal power management")Signed-off-by Dan Carpenter <[email protected]>
Thanks for these fixes.
--Daniel
Quoted 21 lines
--- drivers/powercap/dtpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/powercap/dtpm.c +2
-2@@ -467,9 +467,9 @@ static int __init dtpm_init(void)struct dtpm_descr **dtpm_descr; pct =powercap_register_control_type (NULL ,"dtpm" ,NULL ); -if (!pct) { +if (IS_ERR (pct)) {pr_err ("Failed to register control type\n" ); -return -EINVAL ; +return PTR_ERR (pct); }for_each_dtpm_table (dtpm_descr)
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Rafael J. Wysocki
maintainerRe: [PATCH 3/3] powercap/drivers/dtpm: Fix an IS_ERR() vs NULL check
Quoted 11 lines · Daniel Lezcano
Quoted 5 lines · Dan Carpenter
The
powercap_register_control_type()function never returns NULL, it returns error pointers on error so update this check.Fixes a20d0ef97abf ("powercap/drivers/dtpm: Add API for dynamic thermal power management")Signed-off-by Dan Carpenter <[email protected]>Acked-by Daniel Lezcano <[email protected]>Thanks for these fixes.
All 3 patches applied, but as the original DTPM changes have not made it into 5.11-rc, all of this is 5.12 material now.
Quoted 7 lines · Dan Carpenter
The
DTPM_POWER_LIMIT_FLAGis used fortest_bit()etc which take a bit number so it should be bit 0. But currently it's set to BIT(0) then that is double shifted equivalent to BIT(BIT(0)). This doesn't cause a run time problem because it's done consistently.Fixes a20d0ef97abf ("powercap/drivers/dtpm: Add API for dynamic thermal power management")Signed-off-by Dan Carpenter <[email protected]>
Quoted 18 lines
--- drivers/powercap/dtpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/powercap/dtpm.c +1
-1@@ -24,7 +24,7 @@#include <linux/slab.h> #include <linux/mutex.h> -#define DTPM_POWER_LIMIT_FLAG BIT(0) +#define DTPM_POWER_LIMIT_FLAG 0static const char *constraint_name[] = {"Instantaneous" ,
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog