Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1536836 > unrolled thread

[PATCH 1/1] cpufreq: Fix NULL pointer comparison warning

Started byMohamed Wasif <m.wasif@samsung.com>
First post2016-12-06 11:30 +0100
Last post2016-12-06 22:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] cpufreq: Fix NULL pointer comparison warning Mohamed Wasif <m.wasif@samsung.com> - 2016-12-06 11:30 +0100
    Re: [PATCH 1/1] cpufreq: Fix NULL pointer comparison warning "Rafael J. Wysocki" <rafael@kernel.org> - 2016-12-06 22:10 +0100

#1536836 — [PATCH 1/1] cpufreq: Fix NULL pointer comparison warning

FromMohamed Wasif <m.wasif@samsung.com>
Date2016-12-06 11:30 +0100
Subject[PATCH 1/1] cpufreq: Fix NULL pointer comparison warning
Message-ID<sLlax-Oj-5@gated-at.bofh.it>
Replace direct comparisons to NULL
This problem was detected by checkpatch.

Signed-off-by: Mohamed Wasif <m.wasif@samsung.com>
---
 drivers/cpufreq/cpufreq.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 6e6c1fb..ca3542e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -590,7 +590,7 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
 
 		t = find_governor(str_governor);
 
-		if (t == NULL) {
+		if (!t) {
 			int ret;
 
 			mutex_unlock(&cpufreq_governor_mutex);
@@ -601,7 +601,7 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
 				t = find_governor(str_governor);
 		}
 
-		if (t != NULL) {
+		if (t) {
 			*governor = t;
 			err = 0;
 		}
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1537275

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2016-12-06 22:10 +0100
Message-ID<sLv9U-7hY-55@gated-at.bofh.it>
In reply to#1536836
On Tue, Dec 6, 2016 at 11:17 AM, Mohamed Wasif <m.wasif@samsung.com> wrote:
> Replace direct comparisons to NULL
> This problem was detected by checkpatch.
>
> Signed-off-by: Mohamed Wasif <m.wasif@samsung.com>
> ---
>  drivers/cpufreq/cpufreq.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 6e6c1fb..ca3542e 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -590,7 +590,7 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
>
>                 t = find_governor(str_governor);
>
> -               if (t == NULL) {
> +               if (!t) {
>                         int ret;
>
>                         mutex_unlock(&cpufreq_governor_mutex);
> @@ -601,7 +601,7 @@ static int cpufreq_parse_governor(char *str_governor, unsigned int *policy,
>                                 t = find_governor(str_governor);
>                 }
>
> -               if (t != NULL) {
> +               if (t) {
>                         *governor = t;
>                         err = 0;
>                 }
> --

The code is correct as is and this patch doesn't fix anything.

Besides, you are supposed to run checkpatch against *patches* and not
against existing code.

Thanks,
Rafael

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web