[PATCH 04/16] Staging: speakup: kobjects.c: Remove explicit NULL comparison

From: Shraddha Barke
Date: Thu Sep 10 2015 - 21:55:50 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/