mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 08:20:52 +07:00
char: make misc_deregister a void function
With well over 200+ users of this api, there are a mere 12 users that actually checked the return value of this function. And all of them really didn't do anything with that information as the system or module was shutting down no matter what. So stop pretending like it matters, and just return void from misc_deregister(). If something goes wrong in the call, you will get a WARNING splat in the syslog so you know how to fix up your driver. Other than that, there's nothing that can go wrong. Cc: Alasdair Kergon <agk@redhat.com> Cc: Neil Brown <neilb@suse.com> Cc: Oleg Drokin <oleg.drokin@intel.com> Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Christine Caulfield <ccaulfie@redhat.com> Cc: David Teigland <teigland@redhat.com> Cc: Mark Fasheh <mfasheh@suse.com> Acked-by: Joel Becker <jlbec@evilplan.org> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
379e4f756b
commit
f368ed6088
@ -243,17 +243,15 @@ int misc_register(struct miscdevice * misc)
|
||||
* @misc: device to unregister
|
||||
*
|
||||
* Unregister a miscellaneous device that was previously
|
||||
* successfully registered with misc_register(). Success
|
||||
* is indicated by a zero return, a negative errno code
|
||||
* indicates an error.
|
||||
* successfully registered with misc_register().
|
||||
*/
|
||||
|
||||
int misc_deregister(struct miscdevice *misc)
|
||||
void misc_deregister(struct miscdevice *misc)
|
||||
{
|
||||
int i = DYNAMIC_MINORS - misc->minor - 1;
|
||||
|
||||
if (WARN_ON(list_empty(&misc->list)))
|
||||
return -EINVAL;
|
||||
return;
|
||||
|
||||
mutex_lock(&misc_mtx);
|
||||
list_del(&misc->list);
|
||||
@ -261,7 +259,6 @@ int misc_deregister(struct miscdevice *misc)
|
||||
if (i < DYNAMIC_MINORS && i >= 0)
|
||||
clear_bit(i, misc_minors);
|
||||
mutex_unlock(&misc_mtx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(misc_register);
|
||||
|
@ -1919,9 +1919,7 @@ int __init dm_interface_init(void)
|
||||
|
||||
void dm_interface_exit(void)
|
||||
{
|
||||
if (misc_deregister(&_dm_misc) < 0)
|
||||
DMERR("misc_deregister failed for control device");
|
||||
|
||||
misc_deregister(&_dm_misc);
|
||||
dm_hash_exit();
|
||||
}
|
||||
|
||||
|
@ -1031,14 +1031,9 @@ int __init vmci_host_init(void)
|
||||
|
||||
void __exit vmci_host_exit(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
vmci_host_device_initialized = false;
|
||||
|
||||
error = misc_deregister(&vmci_host_miscdev);
|
||||
if (error)
|
||||
pr_warn("Error unregistering character device: %d\n", error);
|
||||
|
||||
misc_deregister(&vmci_host_miscdev);
|
||||
vmci_ctx_destroy(host_context);
|
||||
vmci_qp_broker_exit();
|
||||
|
||||
|
@ -666,9 +666,8 @@ static int ds1374_remove(struct i2c_client *client)
|
||||
#ifdef CONFIG_RTC_DRV_DS1374_WDT
|
||||
int res;
|
||||
|
||||
res = misc_deregister(&ds1374_miscdev);
|
||||
if (!res)
|
||||
ds1374_miscdev.parent = NULL;
|
||||
misc_deregister(&ds1374_miscdev);
|
||||
ds1374_miscdev.parent = NULL;
|
||||
unregister_reboot_notifier(&ds1374_wdt_notifier);
|
||||
#endif
|
||||
|
||||
|
@ -863,14 +863,9 @@ static int __init ashmem_init(void)
|
||||
|
||||
static void __exit ashmem_exit(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
unregister_shrinker(&ashmem_shrinker);
|
||||
|
||||
ret = misc_deregister(&ashmem_misc);
|
||||
if (unlikely(ret))
|
||||
pr_err("failed to unregister misc device!\n");
|
||||
|
||||
misc_deregister(&ashmem_misc);
|
||||
kmem_cache_destroy(ashmem_range_cachep);
|
||||
kmem_cache_destroy(ashmem_area_cachep);
|
||||
|
||||
|
@ -269,7 +269,8 @@ static int ion_test_remove(struct platform_device *pdev)
|
||||
if (!testdev)
|
||||
return -ENODATA;
|
||||
|
||||
return misc_deregister(&testdev->misc);
|
||||
misc_deregister(&testdev->misc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_device *ion_test_pdev;
|
||||
|
@ -467,9 +467,7 @@ static void exit_libcfs_module(void)
|
||||
cfs_crypto_unregister();
|
||||
cfs_wi_shutdown();
|
||||
|
||||
rc = misc_deregister(&libcfs_dev);
|
||||
if (rc)
|
||||
CERROR("misc_deregister error %d\n", rc);
|
||||
misc_deregister(&libcfs_dev);
|
||||
|
||||
cfs_cpu_fini();
|
||||
|
||||
|
@ -1573,9 +1573,9 @@ static int __init vhost_scsi_register(void)
|
||||
return misc_register(&vhost_scsi_misc);
|
||||
}
|
||||
|
||||
static int vhost_scsi_deregister(void)
|
||||
static void vhost_scsi_deregister(void)
|
||||
{
|
||||
return misc_deregister(&vhost_scsi_misc);
|
||||
misc_deregister(&vhost_scsi_misc);
|
||||
}
|
||||
|
||||
static char *vhost_scsi_dump_proto_id(struct vhost_scsi_tport *tport)
|
||||
|
@ -269,9 +269,8 @@ static int at91wdt_remove(struct platform_device *pdev)
|
||||
if (res)
|
||||
dev_warn(dev, "failed to unregister restart handler\n");
|
||||
|
||||
res = misc_deregister(&at91wdt_miscdev);
|
||||
if (!res)
|
||||
at91wdt_miscdev.parent = NULL;
|
||||
misc_deregister(&at91wdt_miscdev);
|
||||
at91wdt_miscdev.parent = NULL;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -254,13 +254,10 @@ static int ks8695wdt_probe(struct platform_device *pdev)
|
||||
|
||||
static int ks8695wdt_remove(struct platform_device *pdev)
|
||||
{
|
||||
int res;
|
||||
misc_deregister(&ks8695wdt_miscdev);
|
||||
ks8695wdt_miscdev.parent = NULL;
|
||||
|
||||
res = misc_deregister(&ks8695wdt_miscdev);
|
||||
if (!res)
|
||||
ks8695wdt_miscdev.parent = NULL;
|
||||
|
||||
return res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ks8695wdt_shutdown(struct platform_device *pdev)
|
||||
|
@ -428,7 +428,8 @@ static int ts72xx_wdt_probe(struct platform_device *pdev)
|
||||
|
||||
static int ts72xx_wdt_remove(struct platform_device *pdev)
|
||||
{
|
||||
return misc_deregister(&ts72xx_wdt_miscdev);
|
||||
misc_deregister(&ts72xx_wdt_miscdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver ts72xx_wdt_driver = {
|
||||
|
@ -2163,8 +2163,7 @@ static int btrfs_interface_init(void)
|
||||
|
||||
static void btrfs_interface_exit(void)
|
||||
{
|
||||
if (misc_deregister(&btrfs_misc) < 0)
|
||||
printk(KERN_INFO "BTRFS: misc_deregister failed for control device\n");
|
||||
misc_deregister(&btrfs_misc);
|
||||
}
|
||||
|
||||
static void btrfs_print_info(void)
|
||||
|
@ -509,7 +509,6 @@ int dlm_plock_init(void)
|
||||
|
||||
void dlm_plock_exit(void)
|
||||
{
|
||||
if (misc_deregister(&plock_dev_misc) < 0)
|
||||
log_print("dlm_plock_exit: misc_deregister failed");
|
||||
misc_deregister(&plock_dev_misc);
|
||||
}
|
||||
|
||||
|
@ -362,18 +362,15 @@ static int dlm_device_register(struct dlm_ls *ls, char *name)
|
||||
|
||||
int dlm_device_deregister(struct dlm_ls *ls)
|
||||
{
|
||||
int error;
|
||||
|
||||
/* The device is not registered. This happens when the lockspace
|
||||
was never used from userspace, or when device_create_lockspace()
|
||||
calls dlm_release_lockspace() after the register fails. */
|
||||
if (!ls->ls_device.name)
|
||||
return 0;
|
||||
|
||||
error = misc_deregister(&ls->ls_device);
|
||||
if (!error)
|
||||
kfree(ls->ls_device.name);
|
||||
return error;
|
||||
misc_deregister(&ls->ls_device);
|
||||
kfree(ls->ls_device.name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int device_user_purge(struct dlm_user_proc *proc,
|
||||
|
@ -655,14 +655,7 @@ static int ocfs2_control_init(void)
|
||||
|
||||
static void ocfs2_control_exit(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = misc_deregister(&ocfs2_control_device);
|
||||
if (rc)
|
||||
printk(KERN_ERR
|
||||
"ocfs2: Unable to deregister ocfs2_control device "
|
||||
"(errno %d)\n",
|
||||
-rc);
|
||||
misc_deregister(&ocfs2_control_device);
|
||||
}
|
||||
|
||||
static void fsdlm_lock_ast_wrapper(void *astarg)
|
||||
|
@ -67,7 +67,7 @@ struct miscdevice {
|
||||
};
|
||||
|
||||
extern int misc_register(struct miscdevice *misc);
|
||||
extern int misc_deregister(struct miscdevice *misc);
|
||||
extern void misc_deregister(struct miscdevice *misc);
|
||||
|
||||
#define MODULE_ALIAS_MISCDEV(minor) \
|
||||
MODULE_ALIAS("char-major-" __stringify(MISC_MAJOR) \
|
||||
|
Loading…
Reference in New Issue
Block a user