Commit c2e4c685 authored by Varsha Rao's avatar Varsha Rao Committed by Greg Kroah-Hartman

staging: speakup: Replace BUG_ON() with WARN_ON().


[ Upstream commit d351c2db ]

BUG_ON() is replaced with WARN_ON() and EINVAL is returned, when
WARN_ON() is true. This fixes the following checkpatch issue:

Avoid crashing the kernel - try using WARN_ON & recovery code rather
than BUG() or BUG_ON().
Signed-off-by: default avatarVarsha Rao <rvarsha016@gmail.com>
Reviewed-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3389b386
...@@ -831,7 +831,9 @@ static ssize_t message_show(struct kobject *kobj, ...@@ -831,7 +831,9 @@ static ssize_t message_show(struct kobject *kobj,
struct msg_group_t *group = spk_find_msg_group(attr->attr.name); struct msg_group_t *group = spk_find_msg_group(attr->attr.name);
unsigned long flags; unsigned long flags;
BUG_ON(!group); if (WARN_ON(!group))
return -EINVAL;
spin_lock_irqsave(&speakup_info.spinlock, flags); spin_lock_irqsave(&speakup_info.spinlock, flags);
retval = message_show_helper(buf, group->start, group->end); retval = message_show_helper(buf, group->start, group->end);
spin_unlock_irqrestore(&speakup_info.spinlock, flags); spin_unlock_irqrestore(&speakup_info.spinlock, flags);
...@@ -843,7 +845,9 @@ static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr, ...@@ -843,7 +845,9 @@ static ssize_t message_store(struct kobject *kobj, struct kobj_attribute *attr,
{ {
struct msg_group_t *group = spk_find_msg_group(attr->attr.name); struct msg_group_t *group = spk_find_msg_group(attr->attr.name);
BUG_ON(!group); if (WARN_ON(!group))
return -EINVAL;
return message_store_helper(buf, count, group); return message_store_helper(buf, count, group);
} }
......
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