All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: kobjects: Delete comparison
@ 2017-03-07  9:21 Tamara Diaconita
  2017-03-07 13:57 ` [Outreachy kernel] " Daniel Baluta
  2017-03-07 16:08 ` Julia Lawall
  0 siblings, 2 replies; 3+ messages in thread
From: Tamara Diaconita @ 2017-03-07  9:21 UTC (permalink / raw)
  To: w.d.hubbs, chris, kirk, samuel.thibault, gregkh, outreachy-kernel
  Cc: Tamara Diaconita

Delete comparison in 'if' structure to fix the checkpath.pl issue:
CHECK: Comparison to NULL could be written 'synth'.

Comparison to NULL is not necessary because 'if' structure tests if
'synth' is NULL anyway.

Signed-off-by: Tamara Diaconita <diaconita.tamara@gmail.com>
---
 drivers/staging/speakup/kobjects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index ac6ed8b..0cd5384 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -391,7 +391,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
 		len--;
 	new_synth_name[len] = '\0';
 	spk_strlwr(new_synth_name);
-	if ((synth != NULL) && (!strcmp(new_synth_name, synth->name))) {
+	if ((synth) && (!strcmp(new_synth_name, synth->name))) {
 		pr_warn("%s already in use\n", new_synth_name);
 	} else if (synth_init(new_synth_name) != 0) {
 		pr_warn("failed to init synth %s\n", new_synth_name);
-- 
2.9.3



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

* Re: [Outreachy kernel] [PATCH] staging: speakup: kobjects: Delete comparison
  2017-03-07  9:21 [PATCH] staging: speakup: kobjects: Delete comparison Tamara Diaconita
@ 2017-03-07 13:57 ` Daniel Baluta
  2017-03-07 16:08 ` Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2017-03-07 13:57 UTC (permalink / raw)
  To: Tamara Diaconita
  Cc: William Hubbs, Christopher Brannon, kirk, Samuel Thibault,
	Greg Kroah-Hartman, outreachy-kernel, Tamara Diaconita

On Tue, Mar 7, 2017 at 11:21 AM, Tamara Diaconita
<diaconitatamara@gmail.com> wrote:
> Delete comparison in 'if' structure to fix the checkpath.pl issue:
> CHECK: Comparison to NULL could be written 'synth'.
>
> Comparison to NULL is not necessary because 'if' structure tests if
> 'synth' is NULL anyway.
This explanation should be placed before mentioning checkpatch.pl.

The commit message shouldn't focus on the error reported
by checkpatch, but mostly on why this patch is needed.

After, you explain this you can add a mention that it was discovered
using checkpatch :).


>
> Signed-off-by: Tamara Diaconita <diaconita.tamara@gmail.com>
> ---
>  drivers/staging/speakup/kobjects.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index ac6ed8b..0cd5384 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -391,7 +391,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
>                 len--;
>         new_synth_name[len] = '\0';
>         spk_strlwr(new_synth_name);
> -       if ((synth != NULL) && (!strcmp(new_synth_name, synth->name))) {
> +       if ((synth) && (!strcmp(new_synth_name, synth->name))) {
>                 pr_warn("%s already in use\n", new_synth_name);

At this point you can remove the parenthesis (synth) -> synth

>         } else if (synth_init(new_synth_name) != 0) {
>                 pr_warn("failed to init synth %s\n", new_synth_name);


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

* Re: [Outreachy kernel] [PATCH] staging: speakup: kobjects: Delete comparison
  2017-03-07  9:21 [PATCH] staging: speakup: kobjects: Delete comparison Tamara Diaconita
  2017-03-07 13:57 ` [Outreachy kernel] " Daniel Baluta
@ 2017-03-07 16:08 ` Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2017-03-07 16:08 UTC (permalink / raw)
  To: Tamara Diaconita
  Cc: w.d.hubbs, chris, kirk, samuel.thibault, gregkh,
	outreachy-kernel, Tamara Diaconita



On Tue, 7 Mar 2017, Tamara Diaconita wrote:

> Delete comparison in 'if' structure to fix the checkpath.pl issue:
> CHECK: Comparison to NULL could be written 'synth'.
>
> Comparison to NULL is not necessary because 'if' structure tests if
> 'synth' is NULL anyway.
>
> Signed-off-by: Tamara Diaconita <diaconita.tamara@gmail.com>
> ---
>  drivers/staging/speakup/kobjects.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index ac6ed8b..0cd5384 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -391,7 +391,7 @@ static ssize_t synth_store(struct kobject *kobj, struct kobj_attribute *attr,
>  		len--;
>  	new_synth_name[len] = '\0';
>  	spk_strlwr(new_synth_name);
> -	if ((synth != NULL) && (!strcmp(new_synth_name, synth->name))) {
> +	if ((synth) && (!strcmp(new_synth_name, synth->name))) {

The parentheses around synth are also not needed.

julia

>  		pr_warn("%s already in use\n", new_synth_name);
>  	} else if (synth_init(new_synth_name) != 0) {
>  		pr_warn("failed to init synth %s\n", new_synth_name);
> --
> 2.9.3
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170307092155.14802-1-diaconita.tamara%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

end of thread, other threads:[~2017-03-07 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-07  9:21 [PATCH] staging: speakup: kobjects: Delete comparison Tamara Diaconita
2017-03-07 13:57 ` [Outreachy kernel] " Daniel Baluta
2017-03-07 16:08 ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.