Skip to content

Commit 8a2a806

Browse files
committed
ipmi: make ipmi_destroy_user() return void
JIRA: https://issues.redhat.com/browse/RHEL-82110 Upstream status: v6.14 commit 9b6442a Author: Vitaliy Shevtsov <v.shevtsov@maxima.ru> Date: Wed Dec 25 01:45:30 2024 +0000 ipmi: make ipmi_destroy_user() return void Return value of ipmi_destroy_user() has no meaning, because it's always zero and callers can do nothing with it. And in most cases it's not checked. So make this function return void. This also will eliminate static code analyzer warnings such as unreachable code/redundant comparison when the return value is checked against non-zero value. Found by Linux Verification Center (linuxtesting.org) with Svace. Signed-off-by: Vitaliy Shevtsov <v.shevtsov@maxima.ru> Message-ID: <20241225014532.20091-1-v.shevtsov@maxima.ru> Signed-off-by: Corey Minyard <corey@minyard.net> Signed-off-by: Tony Camuso <tcamuso@redhat.com>
1 parent ed918f3 commit 8a2a806

File tree

5 files changed

+5
-17
lines changed

5 files changed

+5
-17
lines changed

drivers/char/ipmi/ipmi_devintf.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,9 @@ static int ipmi_open(struct inode *inode, struct file *file)
122122
static int ipmi_release(struct inode *inode, struct file *file)
123123
{
124124
struct ipmi_file_private *priv = file->private_data;
125-
int rv;
126125
struct ipmi_recv_msg *msg, *next;
127126

128-
rv = ipmi_destroy_user(priv->user);
129-
if (rv)
130-
return rv;
127+
ipmi_destroy_user(priv->user);
131128

132129
list_for_each_entry_safe(msg, next, &priv->recv_msgs, link)
133130
ipmi_free_recv_msg(msg);

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,13 +1399,11 @@ static void _ipmi_destroy_user(struct ipmi_user *user)
13991399
module_put(owner);
14001400
}
14011401

1402-
int ipmi_destroy_user(struct ipmi_user *user)
1402+
void ipmi_destroy_user(struct ipmi_user *user)
14031403
{
14041404
_ipmi_destroy_user(user);
14051405

14061406
kref_put(&user->refcount, free_user);
1407-
1408-
return 0;
14091407
}
14101408
EXPORT_SYMBOL(ipmi_destroy_user);
14111409

drivers/char/ipmi/ipmi_poweroff.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,18 +699,14 @@ static int __init ipmi_poweroff_init(void)
699699
#ifdef MODULE
700700
static void __exit ipmi_poweroff_cleanup(void)
701701
{
702-
int rv;
703-
704702
#ifdef CONFIG_PROC_FS
705703
unregister_sysctl_table(ipmi_table_header);
706704
#endif
707705

708706
ipmi_smi_watcher_unregister(&smi_watcher);
709707

710708
if (ready) {
711-
rv = ipmi_destroy_user(ipmi_user);
712-
if (rv)
713-
pr_err("could not cleanup the IPMI user: 0x%x\n", rv);
709+
ipmi_destroy_user(ipmi_user);
714710
pm_power_off = old_poweroff_func;
715711
}
716712
}

drivers/char/ipmi/ipmi_watchdog.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,6 @@ static void ipmi_register_watchdog(int ipmi_intf)
10641064

10651065
static void ipmi_unregister_watchdog(int ipmi_intf)
10661066
{
1067-
int rv;
10681067
struct ipmi_user *loc_user = watchdog_user;
10691068

10701069
if (!loc_user)
@@ -1089,9 +1088,7 @@ static void ipmi_unregister_watchdog(int ipmi_intf)
10891088
mutex_lock(&ipmi_watchdog_mutex);
10901089

10911090
/* Disconnect from IPMI. */
1092-
rv = ipmi_destroy_user(loc_user);
1093-
if (rv)
1094-
pr_warn("error unlinking from IPMI: %d\n", rv);
1091+
ipmi_destroy_user(loc_user);
10951092

10961093
/* If it comes back, restart it properly. */
10971094
ipmi_start_timer_on_heartbeat = 1;

include/linux/ipmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int ipmi_create_user(unsigned int if_num,
126126
* the users before you destroy the callback structures, it should be
127127
* safe, too.
128128
*/
129-
int ipmi_destroy_user(struct ipmi_user *user);
129+
void ipmi_destroy_user(struct ipmi_user *user);
130130

131131
/* Get the IPMI version of the BMC we are talking to. */
132132
int ipmi_get_version(struct ipmi_user *user,

0 commit comments

Comments
 (0)