mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
ipmi: lots of little tweaks
Nothing huge, the biggest issue was a possible refcount underflow that could cause a memory leak in some situations. Otherwise, fixing formatting and style things and some docs typos. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmo8Kd8ACgkQYfOMkJGb /4EJyxAAkY1swdh9aPxQF7vUsjsHpA5ZOYhvJSFjoVedsIzEAjFZ6o4z3kT1mMIk m/1i//FuWz9ltZjVoG/etbDbAITG+hsBdmYPNZk5ymg4TJKYdM0vZkNNngyz9RSK xvoqK6hVAlRIg76EJLRNqcvyKfXlMDfnvlv7AlfvoESd1++olbANwgB1lcQAAPql q0fkIdKsaSR/UH8AARD7U9Zh/UMcCiaNFiFanERb+La6GQnZ7/vwmkIsFMUxvlM9 On1+ocdfUAgJ/G8XV4JpQNxF8LurCVByCIhlIvhd7AKi1kOeMj3pLBzpqzscq8Oi uxIdsi1TEQyJXO5N+xvWd36HOLhKL6U7coDSRoAWdSVeSDj3HrowmIGIh/cngeDJ f3YaXKm3mJHTmGcd+bvWEF4/xX0sPdybgSsrP/PHlMmy5LZLJteRay8ZsRHluKkh XMvTwUpVjTm5YMA3gbQVjvRILrI+2fQPYx9FVRKz9fFis32lvkUhbhc80ir4jXsw /t/2qq5BMmbqx4RT8drejVZHafWIE/Qdz7QwFf0FB8luqkKjNEir73AefZjnoy5b bD8e5BM/zm1bysZzoOV5r8dDIEtn7wCVUmLiQSIwF50epdy8ue2yIB4Q91ewMdws PvyHuc/g40/WPmGwvp4MZ2Gu2+/v9jaaNP13lgPu6oVUKwgNmBo= =DWx/ -----END PGP SIGNATURE----- Merge tag 'for-linus-7.2-1' of https://github.com/cminyard/linux-ipmi Pull ipmi updates from Corey Minyard: "Lots of little tweaks. Nothing huge, the biggest issue was a possible refcount underflow that could cause a memory leak in some situations. Otherwise, fixing formatting and style things and some docs typos" * tag 'for-linus-7.2-1' of https://github.com/cminyard/linux-ipmi: docs: ipmi: Fix path of the "hotmod" module parameter ipmi: Drop unused assignment of platform_device_id driver data ipmi: si: Use platform_get_irq_optional() to retrieve interrupt ipmi: fix refcount leak in i_ipmi_request() ipmi:ssif: Drop unused assignment of platform_device_id driver data ipmi: Fix user refcount underflow in event delivery ipmi: Use named initializers for struct i2c_device_id ipmi: Use LIST_HEAD() to initialize on stack list head ipmi:kcs: Reduce the number of retries
This commit is contained in:
commit
504c806528
|
|
@ -495,7 +495,7 @@ tuned to the user's desired performance.
|
|||
|
||||
The driver supports a hot add and remove of interfaces. This way,
|
||||
interfaces can be added or removed after the kernel is up and running.
|
||||
This is done using /sys/modules/ipmi_si/parameters/hotmod, which is a
|
||||
This is done using /sys/module/ipmi_si/parameters/hotmod, which is a
|
||||
write-only parameter. You write a string to this interface. The string
|
||||
has the format::
|
||||
|
||||
|
|
|
|||
|
|
@ -353,8 +353,8 @@ static void ipmb_remove(struct i2c_client *client)
|
|||
}
|
||||
|
||||
static const struct i2c_device_id ipmb_id[] = {
|
||||
{ "ipmb-dev" },
|
||||
{}
|
||||
{ .name = "ipmb-dev" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ipmb_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -566,8 +566,8 @@ MODULE_DEVICE_TABLE(of, of_ipmi_ipmb_match);
|
|||
#endif
|
||||
|
||||
static const struct i2c_device_id ipmi_ipmb_id[] = {
|
||||
{ DEVICE_NAME },
|
||||
{}
|
||||
{ .name = DEVICE_NAME },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ipmi_ipmb_id);
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ enum kcs_states {
|
|||
/* Timeouts in microseconds. */
|
||||
#define IBF_RETRY_TIMEOUT (5*USEC_PER_SEC)
|
||||
#define OBF_RETRY_TIMEOUT (5*USEC_PER_SEC)
|
||||
#define MAX_ERROR_RETRIES 10
|
||||
#define MAX_ERROR_RETRIES 2
|
||||
#define ERROR0_OBF_WAIT_JIFFIES (2*HZ)
|
||||
|
||||
struct si_sm_data {
|
||||
|
|
|
|||
|
|
@ -1610,14 +1610,12 @@ int ipmi_set_gets_events(struct ipmi_user *user, bool val)
|
|||
{
|
||||
struct ipmi_smi *intf = user->intf;
|
||||
struct ipmi_recv_msg *msg, *msg2;
|
||||
struct list_head msgs;
|
||||
LIST_HEAD(msgs);
|
||||
|
||||
user = acquire_ipmi_user(user);
|
||||
if (!user)
|
||||
return -ENODEV;
|
||||
|
||||
INIT_LIST_HEAD(&msgs);
|
||||
|
||||
mutex_lock(&intf->events_mutex);
|
||||
if (user->gets_events == val)
|
||||
goto out;
|
||||
|
|
@ -2347,6 +2345,10 @@ static int i_ipmi_request(struct ipmi_user *user,
|
|||
if (smi_msg == NULL) {
|
||||
if (!supplied_recv)
|
||||
ipmi_free_recv_msg(recv_msg);
|
||||
else if (recv_msg->user) {
|
||||
atomic_dec(&recv_msg->user->nr_msgs);
|
||||
kref_put(&recv_msg->user->refcount, free_ipmi_user);
|
||||
}
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
|
@ -2420,6 +2422,10 @@ static int i_ipmi_request(struct ipmi_user *user,
|
|||
ipmi_free_smi_msg(smi_msg);
|
||||
if (!supplied_recv)
|
||||
ipmi_free_recv_msg(recv_msg);
|
||||
else if (recv_msg->user) {
|
||||
atomic_dec(&recv_msg->user->nr_msgs);
|
||||
kref_put(&recv_msg->user->refcount, free_ipmi_user);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -3785,10 +3791,9 @@ static void cleanup_smi_msgs(struct ipmi_smi *intf)
|
|||
struct seq_table *ent;
|
||||
struct ipmi_smi_msg *msg;
|
||||
struct list_head *entry;
|
||||
struct list_head tmplist;
|
||||
LIST_HEAD(tmplist);
|
||||
|
||||
/* Clear out our transmit queues and hold the messages. */
|
||||
INIT_LIST_HEAD(&tmplist);
|
||||
list_splice_tail(&intf->hp_xmit_msgs, &tmplist);
|
||||
list_splice_tail(&intf->xmit_msgs, &tmplist);
|
||||
|
||||
|
|
@ -4442,7 +4447,7 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
|
|||
struct ipmi_smi_msg *msg)
|
||||
{
|
||||
struct ipmi_recv_msg *recv_msg, *recv_msg2;
|
||||
struct list_head msgs;
|
||||
LIST_HEAD(msgs);
|
||||
struct ipmi_user *user;
|
||||
int rv = 0, deliver_count = 0;
|
||||
|
||||
|
|
@ -4457,8 +4462,6 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
|
|||
return 0;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&msgs);
|
||||
|
||||
mutex_lock(&intf->events_mutex);
|
||||
|
||||
ipmi_inc_stat(intf, events);
|
||||
|
|
@ -4477,10 +4480,8 @@ static int handle_read_event_rsp(struct ipmi_smi *intf,
|
|||
mutex_unlock(&intf->users_mutex);
|
||||
list_for_each_entry_safe(recv_msg, recv_msg2, &msgs,
|
||||
link) {
|
||||
user = recv_msg->user;
|
||||
list_del(&recv_msg->link);
|
||||
ipmi_free_recv_msg(recv_msg);
|
||||
kref_put(&user->refcount, free_ipmi_user);
|
||||
}
|
||||
/*
|
||||
* We couldn't allocate memory for the
|
||||
|
|
@ -5101,7 +5102,7 @@ static void check_msg_timeout(struct ipmi_smi *intf, struct seq_table *ent,
|
|||
static bool ipmi_timeout_handler(struct ipmi_smi *intf,
|
||||
unsigned long timeout_period)
|
||||
{
|
||||
struct list_head timeouts;
|
||||
LIST_HEAD(timeouts);
|
||||
struct ipmi_recv_msg *msg, *msg2;
|
||||
unsigned long flags;
|
||||
int i;
|
||||
|
|
@ -5120,7 +5121,6 @@ static bool ipmi_timeout_handler(struct ipmi_smi *intf,
|
|||
* have timed out, putting them in the timeouts
|
||||
* list.
|
||||
*/
|
||||
INIT_LIST_HEAD(&timeouts);
|
||||
mutex_lock(&intf->seq_lock);
|
||||
if (intf->ipmb_maintenance_mode_timeout) {
|
||||
if (intf->ipmb_maintenance_mode_timeout <= timeout_period)
|
||||
|
|
|
|||
|
|
@ -276,7 +276,10 @@ static int of_ipmi_probe(struct platform_device *pdev)
|
|||
io.regspacing = regspacing ? be32_to_cpup(regspacing) : DEFAULT_REGSPACING;
|
||||
io.regshift = regshift ? be32_to_cpup(regshift) : 0;
|
||||
|
||||
io.irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
|
||||
io.irq = platform_get_irq_optional(pdev, 0);
|
||||
if (io.irq < 0)
|
||||
io.irq = 0;
|
||||
|
||||
io.dev = &pdev->dev;
|
||||
|
||||
dev_dbg(&pdev->dev, "addr 0x%lx regsize %d spacing %d irq %d\n",
|
||||
|
|
@ -433,9 +436,9 @@ void ipmi_remove_platform_device_by_name(char *name)
|
|||
}
|
||||
|
||||
static const struct platform_device_id si_plat_ids[] = {
|
||||
{ "dmi-ipmi-si", 0 },
|
||||
{ "hardcode-ipmi-si", 0 },
|
||||
{ "hotmod-ipmi-si", 0 },
|
||||
{ .name = "dmi-ipmi-si" },
|
||||
{ .name = "hardcode-ipmi-si" },
|
||||
{ .name = "hotmod-ipmi-si" },
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2094,7 +2094,7 @@ static int dmi_ipmi_probe(struct platform_device *pdev)
|
|||
#endif
|
||||
|
||||
static const struct i2c_device_id ssif_id[] = {
|
||||
{ DEVICE_NAME },
|
||||
{ .name = DEVICE_NAME },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ssif_id);
|
||||
|
|
@ -2127,7 +2127,7 @@ static void ssif_platform_remove(struct platform_device *dev)
|
|||
}
|
||||
|
||||
static const struct platform_device_id ssif_plat_ids[] = {
|
||||
{ "dmi-ipmi-ssif", 0 },
|
||||
{ .name = "dmi-ipmi-ssif" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(platform, ssif_plat_ids);
|
||||
|
|
|
|||
|
|
@ -874,7 +874,7 @@ static const struct of_device_id ssif_bmc_match[] = {
|
|||
MODULE_DEVICE_TABLE(of, ssif_bmc_match);
|
||||
|
||||
static const struct i2c_device_id ssif_bmc_id[] = {
|
||||
{ DEVICE_NAME },
|
||||
{ .name = DEVICE_NAME },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(i2c, ssif_bmc_id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user