Commit a90624cf authored by Shraddha Barke's avatar Shraddha Barke Committed by Greg Kroah-Hartman
Browse files

Staging: speakup: kobjects.c: Remove explicit NULL comparison



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: default avatarShraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 114885e0
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment