Commit a55b0a02 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-6.6-1' of https://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Minor fixes for IPMI

  Lots of small unconnected things, memory leaks on error, a possible
  (though unlikely) deadlock, changes for updates to other things that
  have changed. Nothing earth-shattering, but things that need update"

* tag 'for-linus-6.6-1' of https://github.com/cminyard/linux-ipmi:
  ipmi_si: fix -Wvoid-pointer-to-enum-cast warning
  ipmi: fix potential deadlock on &kcs_bmc->lock
  ipmi_si: fix a memleak in try_smi_init()
  ipmi: Change request_module to request_module_nowait
  ipmi: make ipmi_class a static const structure
  ipmi:ssif: Fix a memory leak when scanning for an adapter
  ipmi:ssif: Add check for kstrdup
  dt-bindings: ipmi: aspeed,ast2400-kcs-bmc: drop unneeded quotes
  ipmi: Switch i2c drivers back to use .probe()
  ipmi_watchdog: Fix read syscall not responding to signals during sleep
parents ef2a0b7c d40f09c1
......@@ -366,7 +366,7 @@ static struct i2c_driver ipmb_driver = {
.name = "ipmb-dev",
.acpi_match_table = ACPI_PTR(acpi_ipmb_id),
},
.probe_new = ipmb_probe,
.probe = ipmb_probe,
.remove = ipmb_remove,
.id_table = ipmb_id,
};
......
......@@ -807,7 +807,9 @@ struct ipmi_reg_list {
static LIST_HEAD(reg_list);
static DEFINE_MUTEX(reg_list_mutex);
static struct class *ipmi_class;
static const struct class ipmi_class = {
.name = "ipmi",
};
static void ipmi_new_smi(int if_num, struct device *device)
{
......@@ -822,7 +824,7 @@ static void ipmi_new_smi(int if_num, struct device *device)
entry->dev = dev;
mutex_lock(&reg_list_mutex);
device_create(ipmi_class, device, dev, NULL, "ipmi%d", if_num);
device_create(&ipmi_class, device, dev, NULL, "ipmi%d", if_num);
list_add(&entry->link, &reg_list);
mutex_unlock(&reg_list_mutex);
}
......@@ -840,7 +842,7 @@ static void ipmi_smi_gone(int if_num)
break;
}
}
device_destroy(ipmi_class, dev);
device_destroy(&ipmi_class, dev);
mutex_unlock(&reg_list_mutex);
}
......@@ -860,15 +862,13 @@ static int __init init_ipmi_devintf(void)
pr_info("ipmi device interface\n");
ipmi_class = class_create("ipmi");
if (IS_ERR(ipmi_class)) {
pr_err("ipmi: can't register device class\n");
return PTR_ERR(ipmi_class);
}
rv = class_register(&ipmi_class);
if (rv)
return rv;
rv = register_chrdev(ipmi_major, DEVICE_NAME, &ipmi_fops);
if (rv < 0) {
class_destroy(ipmi_class);
class_unregister(&ipmi_class);
pr_err("ipmi: can't get major %d\n", ipmi_major);
return rv;
}
......@@ -880,7 +880,7 @@ static int __init init_ipmi_devintf(void)
rv = ipmi_smi_watcher_register(&smi_watcher);
if (rv) {
unregister_chrdev(ipmi_major, DEVICE_NAME);
class_destroy(ipmi_class);
class_unregister(&ipmi_class);
pr_warn("ipmi: can't register smi watcher\n");
return rv;
}
......@@ -895,11 +895,11 @@ static void __exit cleanup_ipmi(void)
mutex_lock(&reg_list_mutex);
list_for_each_entry_safe(entry, entry2, &reg_list, link) {
list_del(&entry->link);
device_destroy(ipmi_class, entry->dev);
device_destroy(&ipmi_class, entry->dev);
kfree(entry);
}
mutex_unlock(&reg_list_mutex);
class_destroy(ipmi_class);
class_unregister(&ipmi_class);
ipmi_smi_watcher_unregister(&smi_watcher);
unregister_chrdev(ipmi_major, DEVICE_NAME);
}
......
......@@ -572,7 +572,7 @@ static struct i2c_driver ipmi_ipmb_driver = {
.name = DEVICE_NAME,
.of_match_table = of_ipmi_ipmb_match,
},
.probe_new = ipmi_ipmb_probe,
.probe = ipmi_ipmb_probe,
.remove = ipmi_ipmb_remove,
.id_table = ipmi_ipmb_id,
};
......
......@@ -2082,6 +2082,11 @@ static int try_smi_init(struct smi_info *new_smi)
new_smi->io.io_cleanup = NULL;
}
if (rv && new_smi->si_sm) {
kfree(new_smi->si_sm);
new_smi->si_sm = NULL;
}
return rv;
}
......
......@@ -269,7 +269,7 @@ static int of_ipmi_probe(struct platform_device *pdev)
}
memset(&io, 0, sizeof(io));
io.si_type = (enum si_type) match->data;
io.si_type = (unsigned long) match->data;
io.addr_source = SI_DEVICETREE;
io.irq_setup = ipmi_std_irq_setup;
......@@ -381,7 +381,7 @@ static int acpi_ipmi_probe(struct platform_device *pdev)
dev_info(dev, "%pR regsize %d spacing %d irq %d\n",
res, io.regsize, io.regspacing, io.irq);
request_module("acpi_ipmi");
request_module_nowait("acpi_ipmi");
return ipmi_si_add_smi(&io);
}
......
......@@ -1400,7 +1400,7 @@ static struct ssif_addr_info *ssif_info_find(unsigned short addr,
restart:
list_for_each_entry(info, &ssif_infos, link) {
if (info->binfo.addr == addr) {
if (info->addr_src == SI_SMBIOS)
if (info->addr_src == SI_SMBIOS && !info->adapter_name)
info->adapter_name = kstrdup(adapter_name,
GFP_KERNEL);
......@@ -1439,7 +1439,7 @@ static bool check_acpi(struct ssif_info *ssif_info, struct device *dev)
if (acpi_handle) {
ssif_info->addr_source = SI_ACPI;
ssif_info->addr_info.acpi_info.acpi_handle = acpi_handle;
request_module("acpi_ipmi");
request_module_nowait("acpi_ipmi");
return true;
}
#endif
......@@ -1600,6 +1600,11 @@ static int ssif_add_infos(struct i2c_client *client)
info->addr_src = SI_ACPI;
info->client = client;
info->adapter_name = kstrdup(client->adapter->name, GFP_KERNEL);
if (!info->adapter_name) {
kfree(info);
return -ENOMEM;
}
info->binfo.addr = client->addr;
list_add_tail(&info->link, &ssif_infos);
return 0;
......@@ -2054,7 +2059,7 @@ static struct i2c_driver ssif_i2c_driver = {
.driver = {
.name = DEVICE_NAME
},
.probe_new = ssif_probe,
.probe = ssif_probe,
.remove = ssif_remove,
.alert = ssif_alert,
.id_table = ssif_id,
......
......@@ -802,7 +802,7 @@ static ssize_t ipmi_read(struct file *file,
init_waitqueue_entry(&wait, current);
add_wait_queue(&read_q, &wait);
while (!data_to_read) {
while (!data_to_read && !signal_pending(current)) {
set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irq(&ipmi_read_lock);
schedule();
......
......@@ -56,12 +56,13 @@ irqreturn_t kcs_bmc_handle_event(struct kcs_bmc_device *kcs_bmc)
{
struct kcs_bmc_client *client;
irqreturn_t rc = IRQ_NONE;
unsigned long flags;
spin_lock(&kcs_bmc->lock);
spin_lock_irqsave(&kcs_bmc->lock, flags);
client = kcs_bmc->client;
if (client)
rc = client->ops->event(client);
spin_unlock(&kcs_bmc->lock);
spin_unlock_irqrestore(&kcs_bmc->lock, flags);
return rc;
}
......
......@@ -860,7 +860,7 @@ static struct i2c_driver ssif_bmc_driver = {
.name = DEVICE_NAME,
.of_match_table = ssif_bmc_match,
},
.probe_new = ssif_bmc_probe,
.probe = ssif_bmc_probe,
.remove = ssif_bmc_remove,
.id_table = ssif_bmc_id,
};
......
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