* [PATCH v2 0/3] drm/amd/powerplay: Fix coccinelle and checkpatch issues
@ 2017-10-17 20:22 ` Georgiana Chelu
0 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Alex Deucher, Julia Lawall, Christian König, dri-devel
The first two patches fix coccinelle issues and the last patch fix
a checkpatch issue.
First patch: The return value of kzalloc does not need a cast because
the assignment operator will take care of this.
Second patch: The 'result' variable does not change its value until the
end of the function. Instead of using the variable, return its default value.
Third patch: Placing the constant on the right side will make the code easier
to read, as most of the people read from right to left.
Changes in v2:
* adjusted the subject prefix of the patches
* added the cocci script used to generate the patches
Georgiana Chelu (3):
drm/amd/powerplay: Don't cast kzalloc() return value
drm/amd/powerplay: Remove useless variable
drm/amd/powerplay: Place the constant on the right side of the test
.../amd/powerplay/hwmgr/vega10_processpptables.c | 35 ++++++++--------------
1 file changed, 13 insertions(+), 22 deletions(-)
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] drm/amd/powerplay: Don't cast kzalloc() return value
2017-10-17 20:22 ` Georgiana Chelu
@ 2017-10-17 20:22 ` Georgiana Chelu
-1 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Julia Lawall, Alex Deucher, Christian König, David Airlie,
dri-devel
The kzalloc function returns a void pointer and the assignment
operator converts it to the type of pointer it is assigned to.
Therefore, there is no need to cast.
Issue found by alloc_cast.cocci:
* WARNING: casting value returned by memory allocation function
to <struct type> is useless.
Path to the cocci script: scripts/coccinelle/api/alloc/alloc_cast.cocci
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
* added the cocci script used to generate the patches
.../amd/powerplay/hwmgr/vega10_processpptables.c | 24 ++++++++--------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index e343df190375..d968c3834481 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -291,8 +291,7 @@ static int get_mm_clock_voltage_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
mm_dependency_table->ucNumEntries;
- mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ mm_table = kzalloc(table_size, GFP_KERNEL);
if (!mm_table)
return -ENOMEM;
@@ -519,8 +518,7 @@ static int get_socclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -554,8 +552,7 @@ static int get_mclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
mclk_dep_table->ucNumEntries;
- mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ mclk_table = kzalloc(table_size, GFP_KERNEL);
if (!mclk_table)
return -ENOMEM;
@@ -596,8 +593,7 @@ static int get_gfxclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -663,8 +659,7 @@ static int get_pix_clk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -728,8 +723,7 @@ static int get_dcefclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
num_entries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -772,8 +766,7 @@ static int get_pcie_table(struct pp_hwmgr *hwmgr,
sizeof(struct phm_ppt_v1_pcie_record) *
atom_pcie_table->ucNumEntries;
- pcie_table = (struct phm_ppt_v1_pcie_table *)
- kzalloc(table_size, GFP_KERNEL);
+ pcie_table = kzalloc(table_size, GFP_KERNEL);
if (!pcie_table)
return -ENOMEM;
@@ -1026,8 +1019,7 @@ static int get_vddc_lookup_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
- table = (phm_ppt_v1_voltage_lookup_table *)
- kzalloc(table_size, GFP_KERNEL);
+ table = kzalloc(table_size, GFP_KERNEL);
if (NULL == table)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 1/3] drm/amd/powerplay: Don't cast kzalloc() return value
@ 2017-10-17 20:22 ` Georgiana Chelu
0 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Alex Deucher, Julia Lawall, Christian König, dri-devel
The kzalloc function returns a void pointer and the assignment
operator converts it to the type of pointer it is assigned to.
Therefore, there is no need to cast.
Issue found by alloc_cast.cocci:
* WARNING: casting value returned by memory allocation function
to <struct type> is useless.
Path to the cocci script: scripts/coccinelle/api/alloc/alloc_cast.cocci
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
* added the cocci script used to generate the patches
.../amd/powerplay/hwmgr/vega10_processpptables.c | 24 ++++++++--------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index e343df190375..d968c3834481 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -291,8 +291,7 @@ static int get_mm_clock_voltage_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_mm_clock_voltage_dependency_record) *
mm_dependency_table->ucNumEntries;
- mm_table = (phm_ppt_v1_mm_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ mm_table = kzalloc(table_size, GFP_KERNEL);
if (!mm_table)
return -ENOMEM;
@@ -519,8 +518,7 @@ static int get_socclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -554,8 +552,7 @@ static int get_mclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
mclk_dep_table->ucNumEntries;
- mclk_table = (phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ mclk_table = kzalloc(table_size, GFP_KERNEL);
if (!mclk_table)
return -ENOMEM;
@@ -596,8 +593,7 @@ static int get_gfxclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -663,8 +659,7 @@ static int get_pix_clk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
clk_dep_table->ucNumEntries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -728,8 +723,7 @@ static int get_dcefclk_voltage_dependency_table(
sizeof(phm_ppt_v1_clock_voltage_dependency_record) *
num_entries;
- clk_table = (struct phm_ppt_v1_clock_voltage_dependency_table *)
- kzalloc(table_size, GFP_KERNEL);
+ clk_table = kzalloc(table_size, GFP_KERNEL);
if (!clk_table)
return -ENOMEM;
@@ -772,8 +766,7 @@ static int get_pcie_table(struct pp_hwmgr *hwmgr,
sizeof(struct phm_ppt_v1_pcie_record) *
atom_pcie_table->ucNumEntries;
- pcie_table = (struct phm_ppt_v1_pcie_table *)
- kzalloc(table_size, GFP_KERNEL);
+ pcie_table = kzalloc(table_size, GFP_KERNEL);
if (!pcie_table)
return -ENOMEM;
@@ -1026,8 +1019,7 @@ static int get_vddc_lookup_table(
table_size = sizeof(uint32_t) +
sizeof(phm_ppt_v1_voltage_lookup_record) * max_levels;
- table = (phm_ppt_v1_voltage_lookup_table *)
- kzalloc(table_size, GFP_KERNEL);
+ table = kzalloc(table_size, GFP_KERNEL);
if (NULL == table)
return -ENOMEM;
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] drm/amd/powerplay: Remove useless variable
2017-10-17 20:22 ` Georgiana Chelu
@ 2017-10-17 20:22 ` Georgiana Chelu
-1 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Julia Lawall, Alex Deucher, Christian König, David Airlie,
dri-devel
The result variable is initialized at the beginning of the function, but
its value does not change during the function execution. Thus, remove the
variable and return the SUCCESS value, which is 0.
Issue found by coccinelle script:
* Unneeded variable: "result". Return "0"
Path to the cocci script: scripts/coccinelle/misc/returnvar.cocci
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
* added the cocci script used to generate the patches
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index d968c3834481..769ac11a9215 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -1174,7 +1174,6 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
static int vega10_pp_tables_uninitialize(struct pp_hwmgr *hwmgr)
{
- int result = 0;
struct phm_ppt_v2_information *pp_table_info =
(struct phm_ppt_v2_information *)(hwmgr->pptable);
@@ -1217,7 +1216,7 @@ static int vega10_pp_tables_uninitialize(struct pp_hwmgr *hwmgr)
kfree(hwmgr->pptable);
hwmgr->pptable = NULL;
- return result;
+ return 0;
}
const struct pp_table_func vega10_pptable_funcs = {
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH v2 2/3] drm/amd/powerplay: Remove useless variable
@ 2017-10-17 20:22 ` Georgiana Chelu
0 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Alex Deucher, Julia Lawall, Christian König, dri-devel
The result variable is initialized at the beginning of the function, but
its value does not change during the function execution. Thus, remove the
variable and return the SUCCESS value, which is 0.
Issue found by coccinelle script:
* Unneeded variable: "result". Return "0"
Path to the cocci script: scripts/coccinelle/misc/returnvar.cocci
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
* added the cocci script used to generate the patches
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index d968c3834481..769ac11a9215 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -1174,7 +1174,6 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
static int vega10_pp_tables_uninitialize(struct pp_hwmgr *hwmgr)
{
- int result = 0;
struct phm_ppt_v2_information *pp_table_info =
(struct phm_ppt_v2_information *)(hwmgr->pptable);
@@ -1217,7 +1216,7 @@ static int vega10_pp_tables_uninitialize(struct pp_hwmgr *hwmgr)
kfree(hwmgr->pptable);
hwmgr->pptable = NULL;
- return result;
+ return 0;
}
const struct pp_table_func vega10_pptable_funcs = {
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] drm/amd/powerplay: Place the constant on the right side of the test
2017-10-17 20:22 ` Georgiana Chelu
@ 2017-10-17 20:22 ` Georgiana Chelu
-1 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Julia Lawall, Alex Deucher, Christian König, David Airlie,
dri-devel
Move the constant on the right side of the comparison in order to
make the code easier to read.
Issue found by checkpatch script:
* WARNING: Comparisons should place the constant on the right side of
the test
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index 769ac11a9215..f14c7611fad3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -1021,7 +1021,7 @@ static int get_vddc_lookup_table(
table = kzalloc(table_size, GFP_KERNEL);
- if (NULL == table)
+ if (table == NULL)
return -ENOMEM;
table->count = vddc_lookup_pp_tables->ucNumEntries;
@@ -1130,12 +1130,12 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v2_information), GFP_KERNEL);
- PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
+ PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
powerplay_table = get_powerplay_table(hwmgr);
- PP_ASSERT_WITH_CODE((NULL != powerplay_table),
+ PP_ASSERT_WITH_CODE((powerplay_table != NULL),
"Missing PowerPlay Table!", return -1);
result = check_powerplay_tables(hwmgr, powerplay_table);
@@ -1229,7 +1229,7 @@ int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr)
const ATOM_Vega10_State_Array *state_arrays;
const ATOM_Vega10_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
- PP_ASSERT_WITH_CODE((NULL != pp_table),
+ PP_ASSERT_WITH_CODE((pp_table != NULL),
"Missing PowerPlay Table!", return -1);
PP_ASSERT_WITH_CODE((pp_table->sHeader.format_revision >=
ATOM_Vega10_TABLE_REVISION_VEGA10),
--
2.11.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] drm/amd/powerplay: Place the constant on the right side of the test
@ 2017-10-17 20:22 ` Georgiana Chelu
0 siblings, 0 replies; 10+ messages in thread
From: Georgiana Chelu @ 2017-10-17 20:22 UTC (permalink / raw)
To: outreachy-kernel
Cc: Alex Deucher, Julia Lawall, Christian König, dri-devel
Move the constant on the right side of the comparison in order to
make the code easier to read.
Issue found by checkpatch script:
* WARNING: Comparisons should place the constant on the right side of
the test
Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
---
Changes in v2:
* adjusted the subject prefix of the patches
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index 769ac11a9215..f14c7611fad3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -1021,7 +1021,7 @@ static int get_vddc_lookup_table(
table = kzalloc(table_size, GFP_KERNEL);
- if (NULL == table)
+ if (table == NULL)
return -ENOMEM;
table->count = vddc_lookup_pp_tables->ucNumEntries;
@@ -1130,12 +1130,12 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v2_information), GFP_KERNEL);
- PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
+ PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
"Failed to allocate hwmgr->pptable!", return -ENOMEM);
powerplay_table = get_powerplay_table(hwmgr);
- PP_ASSERT_WITH_CODE((NULL != powerplay_table),
+ PP_ASSERT_WITH_CODE((powerplay_table != NULL),
"Missing PowerPlay Table!", return -1);
result = check_powerplay_tables(hwmgr, powerplay_table);
@@ -1229,7 +1229,7 @@ int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr)
const ATOM_Vega10_State_Array *state_arrays;
const ATOM_Vega10_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
- PP_ASSERT_WITH_CODE((NULL != pp_table),
+ PP_ASSERT_WITH_CODE((pp_table != NULL),
"Missing PowerPlay Table!", return -1);
PP_ASSERT_WITH_CODE((pp_table->sHeader.format_revision >=
ATOM_Vega10_TABLE_REVISION_VEGA10),
--
2.11.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] drm/amd/powerplay: Place the constant on the right side of the test
2017-10-17 20:22 ` Georgiana Chelu
@ 2017-10-19 18:45 ` Alex Deucher
-1 siblings, 0 replies; 10+ messages in thread
From: Alex Deucher @ 2017-10-19 18:45 UTC (permalink / raw)
To: Georgiana Chelu
Cc: outreachy-kernel, Alex Deucher, Julia Lawall,
Christian König, Maling list - DRI developers
On Tue, Oct 17, 2017 at 4:22 PM, Georgiana Chelu
<georgiana.chelu93@gmail.com> wrote:
> Move the constant on the right side of the comparison in order to
> make the code easier to read.
>
> Issue found by checkpatch script:
> * WARNING: Comparisons should place the constant on the right side of
> the test
>
> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Applied the series. Thanks you!
Alex
> ---
>
> Changes in v2:
> * adjusted the subject prefix of the patches
>
> drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> index 769ac11a9215..f14c7611fad3 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> @@ -1021,7 +1021,7 @@ static int get_vddc_lookup_table(
>
> table = kzalloc(table_size, GFP_KERNEL);
>
> - if (NULL == table)
> + if (table == NULL)
> return -ENOMEM;
>
> table->count = vddc_lookup_pp_tables->ucNumEntries;
> @@ -1130,12 +1130,12 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
>
> hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v2_information), GFP_KERNEL);
>
> - PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
> + PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
> "Failed to allocate hwmgr->pptable!", return -ENOMEM);
>
> powerplay_table = get_powerplay_table(hwmgr);
>
> - PP_ASSERT_WITH_CODE((NULL != powerplay_table),
> + PP_ASSERT_WITH_CODE((powerplay_table != NULL),
> "Missing PowerPlay Table!", return -1);
>
> result = check_powerplay_tables(hwmgr, powerplay_table);
> @@ -1229,7 +1229,7 @@ int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr)
> const ATOM_Vega10_State_Array *state_arrays;
> const ATOM_Vega10_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
>
> - PP_ASSERT_WITH_CODE((NULL != pp_table),
> + PP_ASSERT_WITH_CODE((pp_table != NULL),
> "Missing PowerPlay Table!", return -1);
> PP_ASSERT_WITH_CODE((pp_table->sHeader.format_revision >=
> ATOM_Vega10_TABLE_REVISION_VEGA10),
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/3] drm/amd/powerplay: Place the constant on the right side of the test
@ 2017-10-19 18:45 ` Alex Deucher
0 siblings, 0 replies; 10+ messages in thread
From: Alex Deucher @ 2017-10-19 18:45 UTC (permalink / raw)
To: Georgiana Chelu
Cc: Alex Deucher, outreachy-kernel, Christian König,
Maling list - DRI developers, Julia Lawall
On Tue, Oct 17, 2017 at 4:22 PM, Georgiana Chelu
<georgiana.chelu93@gmail.com> wrote:
> Move the constant on the right side of the comparison in order to
> make the code easier to read.
>
> Issue found by checkpatch script:
> * WARNING: Comparisons should place the constant on the right side of
> the test
>
> Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Applied the series. Thanks you!
Alex
> ---
>
> Changes in v2:
> * adjusted the subject prefix of the patches
>
> drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> index 769ac11a9215..f14c7611fad3 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
> @@ -1021,7 +1021,7 @@ static int get_vddc_lookup_table(
>
> table = kzalloc(table_size, GFP_KERNEL);
>
> - if (NULL == table)
> + if (table == NULL)
> return -ENOMEM;
>
> table->count = vddc_lookup_pp_tables->ucNumEntries;
> @@ -1130,12 +1130,12 @@ int vega10_pp_tables_initialize(struct pp_hwmgr *hwmgr)
>
> hwmgr->pptable = kzalloc(sizeof(struct phm_ppt_v2_information), GFP_KERNEL);
>
> - PP_ASSERT_WITH_CODE((NULL != hwmgr->pptable),
> + PP_ASSERT_WITH_CODE((hwmgr->pptable != NULL),
> "Failed to allocate hwmgr->pptable!", return -ENOMEM);
>
> powerplay_table = get_powerplay_table(hwmgr);
>
> - PP_ASSERT_WITH_CODE((NULL != powerplay_table),
> + PP_ASSERT_WITH_CODE((powerplay_table != NULL),
> "Missing PowerPlay Table!", return -1);
>
> result = check_powerplay_tables(hwmgr, powerplay_table);
> @@ -1229,7 +1229,7 @@ int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr)
> const ATOM_Vega10_State_Array *state_arrays;
> const ATOM_Vega10_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
>
> - PP_ASSERT_WITH_CODE((NULL != pp_table),
> + PP_ASSERT_WITH_CODE((pp_table != NULL),
> "Missing PowerPlay Table!", return -1);
> PP_ASSERT_WITH_CODE((pp_table->sHeader.format_revision >=
> ATOM_Vega10_TABLE_REVISION_VEGA10),
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 10+ messages in thread