Skip to contentSkip to conversation

staging: speakup: remove NULL comparison

PATCH In review Aastha Gupta 3 participants 3 messages Sep 17, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: speakup: remove NULL comparison

This was done using cocccinelle script:
@@
identifier arg;
@@

-arg==NULL
+!arg

---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
index 938a0aed..e215d05 100644
@@ -2096,7 +2096,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 	u_char shift_info, offset;
 	int ret = 0;
 
-	if (synth == NULL)
+	if (!synth)
 		return 0;
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Aastha Gupta

This was done using cocccinelle script:
@@
identifier arg;
@@

-arg==NULL
+!arg

In general, there is no need to restrict this to an identifier, which will only match a single variable name. expression arg; would match more general cases like x->y == NULL.

julia

Quoted 29 lines
---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -2
index 938a0aed..e215d05 100644
@@ -2096,7 +2096,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 	u_char shift_info, offset;
 	int ret = 0;
 
-	if (synth == NULL)
+	if (!synth)
 		return 0;
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
--

2.7.4

--
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 [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505678435-30853-1-git-send-email-aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Aastha Gupta
Quoted 9 lines · Aastha Gupta, on lun. 18 sept. 2017 01:30:35 +0530, wrote:

This was done using cocccinelle script:
@@
identifier arg;
@@

-arg==NULL
+!arg

Quoted 20 lines
---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
index 938a0aed..e215d05 100644
@@ -2096,7 +2096,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 	u_char shift_info, offset;
 	int ret = 0;
 
-	if (synth == NULL)
+	if (!synth)
 		return 0;
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
Signature · 1 line
2.7.4
Signature · 4 lines
Samuel
"...Deep Hack Mode--that mysterious and frightening state of
consciousness where Mortal Users fear to tread."
(By Matt Welsh)