linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cpufreq/PowerNow-K8: Adjustments for two function implementations
@ 2018-02-15 19:28 SF Markus Elfring
  2018-02-15 19:29 ` [PATCH 1/2] cpufreq: powernow-k8: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
  2018-02-15 19:30 ` [PATCH 2/2] cpufreq: powernow-k8: Delete an unnecessary return statement in two functions SF Markus Elfring
  0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-15 19:28 UTC (permalink / raw)
  To: linux-pm, Rafael J. Wysocki, Viresh Kumar; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 15 Feb 2018 20:24:26 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an error message for a failed memory allocation in three functions
  Delete an unnecessary return statement in two functions

 drivers/cpufreq/powernow-k8.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

-- 
2.16.1

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

* [PATCH 1/2] cpufreq: powernow-k8: Delete an error message for a failed memory allocation in three functions
  2018-02-15 19:28 [PATCH 0/2] cpufreq/PowerNow-K8: Adjustments for two function implementations SF Markus Elfring
@ 2018-02-15 19:29 ` SF Markus Elfring
  2018-02-15 19:30 ` [PATCH 2/2] cpufreq: powernow-k8: Delete an unnecessary return statement in two functions SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-15 19:29 UTC (permalink / raw)
  To: linux-pm, Rafael J. Wysocki, Viresh Kumar; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 15 Feb 2018 20:00:23 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/cpufreq/powernow-k8.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index b01e31db5f83..460bf22a8a2b 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -591,10 +591,8 @@ static int fill_powernow_table(struct powernow_k8_data *data,
 
 	powernow_table = kzalloc((sizeof(*powernow_table)
 		* (data->numps + 1)), GFP_KERNEL);
-	if (!powernow_table) {
-		pr_err("powernow_table memory alloc failure\n");
+	if (!powernow_table)
 		return -ENOMEM;
-	}
 
 	for (j = 0; j < data->numps; j++) {
 		int freq;
@@ -760,10 +758,8 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
 	/* fill in data->powernow_table */
 	powernow_table = kzalloc((sizeof(*powernow_table)
 		* (data->acpi_data.state_count + 1)), GFP_KERNEL);
-	if (!powernow_table) {
-		pr_debug("powernow_table memory alloc failure\n");
+	if (!powernow_table)
 		goto err_out;
-	}
 
 	/* fill in data */
 	data->numps = data->acpi_data.state_count;
@@ -1042,10 +1038,8 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
 		return -ENODEV;
 
 	data = kzalloc(sizeof(*data), GFP_KERNEL);
-	if (!data) {
-		pr_err("unable to alloc powernow_k8_data\n");
+	if (!data)
 		return -ENOMEM;
-	}
 
 	data->cpu = pol->cpu;
 
-- 
2.16.1

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

* [PATCH 2/2] cpufreq: powernow-k8: Delete an unnecessary return statement in two functions
  2018-02-15 19:28 [PATCH 0/2] cpufreq/PowerNow-K8: Adjustments for two function implementations SF Markus Elfring
  2018-02-15 19:29 ` [PATCH 1/2] cpufreq: powernow-k8: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2018-02-15 19:30 ` SF Markus Elfring
  1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-02-15 19:30 UTC (permalink / raw)
  To: linux-pm, Rafael J. Wysocki, Viresh Kumar; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 15 Feb 2018 20:14:32 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/cpufreq/powernow-k8.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 460bf22a8a2b..782a8c2a359d 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -122,14 +122,12 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data)
 static void count_off_irt(struct powernow_k8_data *data)
 {
 	udelay((1 << data->irt) * 10);
-	return;
 }
 
 /* the voltage stabilization time */
 static void count_off_vst(struct powernow_k8_data *data)
 {
 	udelay(data->vstable * VST_UNITS_20US);
-	return;
 }
 
 /* need to init the control msr to a safe value (for each cpu) */
-- 
2.16.1

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

end of thread, other threads:[~2018-02-15 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15 19:28 [PATCH 0/2] cpufreq/PowerNow-K8: Adjustments for two function implementations SF Markus Elfring
2018-02-15 19:29 ` [PATCH 1/2] cpufreq: powernow-k8: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
2018-02-15 19:30 ` [PATCH 2/2] cpufreq: powernow-k8: Delete an unnecessary return statement in two functions SF Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).