mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison
@ 2015-09-11  1:54 Shraddha Barke
  2015-09-11  1:55 ` [PATCH 02/16] Staging: speakup: devsynth.c: " Shraddha Barke
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shraddha Barke @ 2015-09-11  1:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Samuel Thibault, Julia Lawall
  Cc: William Hubbs, speakup, linux-kernel, Shraddha Barke

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/speakup/varhandlers.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index 75bf40c..64042c9 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -90,7 +90,7 @@ void speakup_register_var(struct var_t *var)
 	struct st_var_header *p_header;
 
 	BUG_ON(!var || var->var_id < 0 || var->var_id >= MAXVARS);
-	if (var_ptrs[0] == NULL) {
+	if (!var_ptrs[0]) {
 		for (i = 0; i < MAXVARS; i++) {
 			p_header = &var_headers[i];
 			var_ptrs[p_header->var_id] = p_header;
@@ -130,7 +130,7 @@ struct st_var_header *spk_get_var_header(enum var_id_t var_id)
 	if (var_id < 0 || var_id >= MAXVARS)
 		return NULL;
 	p_header = var_ptrs[var_id];
-	if (p_header->data == NULL)
+	if (!p_header->data)
 		return NULL;
 	return p_header;
 }
@@ -163,7 +163,7 @@ struct punc_var_t *spk_get_punc_var(enum var_id_t var_id)
 	struct punc_var_t *where;
 
 	where = punc_vars;
-	while ((where->var_id != -1) && (rv == NULL)) {
+	while ((where->var_id != -1) && (!rv)) {
 		if (where->var_id == var_id)
 			rv = where;
 		else
@@ -183,7 +183,7 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
 	char *cp;
 	struct var_t *var_data = var->data;
 
-	if (var_data == NULL)
+	if (!var_data)
 		return -ENODATA;
 
 	if (how == E_NEW_DEFAULT) {
@@ -221,7 +221,7 @@ int spk_set_num_var(int input, struct st_var_header *var, int how)
 	if (var_data->u.n.multiplier != 0)
 		val *= var_data->u.n.multiplier;
 	val += var_data->u.n.offset;
-	if (var->var_id < FIRST_SYNTH_VAR || synth == NULL)
+	if (var->var_id < FIRST_SYNTH_VAR || !synth)
 		return ret;
 	if (synth->synth_adjust != NULL) {
 		int status = synth->synth_adjust(var);
@@ -247,7 +247,7 @@ int spk_set_string_var(const char *page, struct st_var_header *var, int len)
 {
 	struct var_t *var_data = var->data;
 
-	if (var_data == NULL)
+	if (!var_data)
 		return -ENODATA;
 	if (len > MAXVARLEN)
 		return -E2BIG;
@@ -313,7 +313,7 @@ char *spk_strlwr(char *s)
 {
 	char *p;
 
-	if (s == NULL)
+	if (!s)
 		return NULL;
 
 	for (p = s; *p; p++)
-- 
2.1.4


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

* [PATCH 02/16] Staging: speakup: devsynth.c: Remove explicit NULL comparison
  2015-09-11  1:54 [PATCH 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison Shraddha Barke
@ 2015-09-11  1:55 ` Shraddha Barke
  2015-09-11  1:55 ` [PATCH 03/16] Staging: speakup: serialio.c: " Shraddha Barke
  2015-09-11  1:55 ` [PATCH 04/16] Staging: speakup: kobjects.c: " Shraddha Barke
  2 siblings, 0 replies; 4+ messages in thread
From: Shraddha Barke @ 2015-09-11  1:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Samuel Thibault, Julia Lawall
  Cc: William Hubbs, speakup, linux-kernel, Shraddha Barke

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/speakup/devsynth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/devsynth.c b/drivers/staging/speakup/devsynth.c
index 71c728a..d1ffdf4 100644
--- a/drivers/staging/speakup/devsynth.c
+++ b/drivers/staging/speakup/devsynth.c
@@ -22,7 +22,7 @@ static ssize_t speakup_file_write(struct file *fp, const char __user *buffer,
 	unsigned long flags;
 	u_char buf[256];
 
-	if (synth == NULL)
+	if (!synth)
 		return -ENODEV;
 	while (count > 0) {
 		bytes = min(count, sizeof(buf));
@@ -45,7 +45,7 @@ static ssize_t speakup_file_read(struct file *fp, char __user *buf,
 
 static int speakup_file_open(struct inode *ip, struct file *fp)
 {
-	if (synth == NULL)
+	if (!synth)
 		return -ENODEV;
 	if (xchg(&dev_opened, 1))
 		return -EBUSY;
-- 
2.1.4


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

* [PATCH 03/16] Staging: speakup: serialio.c: Remove explicit NULL comparison
  2015-09-11  1:54 [PATCH 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison Shraddha Barke
  2015-09-11  1:55 ` [PATCH 02/16] Staging: speakup: devsynth.c: " Shraddha Barke
@ 2015-09-11  1:55 ` Shraddha Barke
  2015-09-11  1:55 ` [PATCH 04/16] Staging: speakup: kobjects.c: " Shraddha Barke
  2 siblings, 0 replies; 4+ messages in thread
From: Shraddha Barke @ 2015-09-11  1:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Samuel Thibault, Julia Lawall
  Cc: William Hubbs, speakup, linux-kernel, Shraddha Barke

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/speakup/serialio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/serialio.c b/drivers/staging/speakup/serialio.c
index 66ac999..3b5835b 100644
--- a/drivers/staging/speakup/serialio.c
+++ b/drivers/staging/speakup/serialio.c
@@ -101,7 +101,7 @@ static void start_serial_interrupt(int irq)
 {
 	int rv;
 
-	if (synth->read_buff_add == NULL)
+	if (!synth->read_buff_add)
 		return;
 
 	rv = request_irq(irq, synth_readbuf_handler, IRQF_SHARED,
@@ -127,7 +127,7 @@ void spk_stop_serial_interrupt(void)
 	if (speakup_info.port_tts == 0)
 		return;
 
-	if (synth->read_buff_add == NULL)
+	if (!synth->read_buff_add)
 		return;
 
 	/* Turn off interrupts */
-- 
2.1.4


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

* [PATCH 04/16] Staging: speakup: kobjects.c: Remove explicit NULL comparison
  2015-09-11  1:54 [PATCH 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison Shraddha Barke
  2015-09-11  1:55 ` [PATCH 02/16] Staging: speakup: devsynth.c: " Shraddha Barke
  2015-09-11  1:55 ` [PATCH 03/16] Staging: speakup: serialio.c: " Shraddha Barke
@ 2015-09-11  1:55 ` Shraddha Barke
  2 siblings, 0 replies; 4+ messages in thread
From: Shraddha Barke @ 2015-09-11  1:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Samuel Thibault, Julia Lawall
  Cc: William Hubbs, speakup, linux-kernel, Shraddha Barke

Remove explicit NULL comparison and write it in its simpler form.
Replacement done with coccinelle:

@replace_rule@
expression e;
@@

-e == NULL
+ !e

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/speakup/kobjects.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 958add4..fdfeb42 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -368,7 +368,7 @@ static ssize_t synth_show(struct kobject *kobj, struct kobj_attribute *attr,
 {
 	int rv;
 
-	if (synth == NULL)
+	if (!synth)
 		rv = sprintf(buf, "%s\n", "none");
 	else
 		rv = sprintf(buf, "%s\n", synth->name);
@@ -459,14 +459,14 @@ static ssize_t punc_show(struct kobject *kobj, struct kobj_attribute *attr,
 	unsigned long flags;
 
 	p_header = spk_var_header_by_name(attr->attr.name);
-	if (p_header == NULL) {
+	if (!p_header) {
 		pr_warn("p_header is null, attr->attr.name is %s\n",
 			attr->attr.name);
 		return -EINVAL;
 	}
 
 	var = spk_get_punc_var(p_header->var_id);
-	if (var == NULL) {
+	if (!var) {
 		pr_warn("var is null, p_header->var_id is %i\n",
 				p_header->var_id);
 		return -EINVAL;
@@ -501,14 +501,14 @@ static ssize_t punc_store(struct kobject *kobj, struct kobj_attribute *attr,
 		return -EINVAL;
 
 	p_header = spk_var_header_by_name(attr->attr.name);
-	if (p_header == NULL) {
+	if (!p_header) {
 		pr_warn("p_header is null, attr->attr.name is %s\n",
 			attr->attr.name);
 		return -EINVAL;
 	}
 
 	var = spk_get_punc_var(p_header->var_id);
-	if (var == NULL) {
+	if (!var) {
 		pr_warn("var is null, p_header->var_id is %i\n",
 				p_header->var_id);
 		return -EINVAL;
@@ -546,7 +546,7 @@ ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr,
 	unsigned long flags;
 
 	param = spk_var_header_by_name(attr->attr.name);
-	if (param == NULL)
+	if (!param)
 		return -EINVAL;
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
@@ -622,9 +622,9 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
 	unsigned long flags;
 
 	param = spk_var_header_by_name(attr->attr.name);
-	if (param == NULL)
+	if (!param)
 		return -EINVAL;
-	if (param->data == NULL)
+	if (!param->data)
 		return 0;
 	ret = 0;
 	cp = (char *)buf;
-- 
2.1.4


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

end of thread, other threads:[~2015-09-11  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-11  1:54 [PATCH 01/16] Staging: speakup: varhandlers.c: Remove explicit NULL comparison Shraddha Barke
2015-09-11  1:55 ` [PATCH 02/16] Staging: speakup: devsynth.c: " Shraddha Barke
2015-09-11  1:55 ` [PATCH 03/16] Staging: speakup: serialio.c: " Shraddha Barke
2015-09-11  1:55 ` [PATCH 04/16] Staging: speakup: kobjects.c: " Shraddha Barke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®