Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f368ed60 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarJoel Becker <jlbec@evilplan.org>
Acked-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 379e4f75
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -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);
+1 −3
Original line number Diff line number Diff line
@@ -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();
}

+1 −6
Original line number Diff line number Diff line
@@ -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();

+2 −3
Original line number Diff line number Diff line
@@ -666,8 +666,7 @@ static int ds1374_remove(struct i2c_client *client)
#ifdef CONFIG_RTC_DRV_DS1374_WDT
	int res;

	res = misc_deregister(&ds1374_miscdev);
	if (!res)
	misc_deregister(&ds1374_miscdev);
	ds1374_miscdev.parent = NULL;
	unregister_reboot_notifier(&ds1374_wdt_notifier);
#endif
+1 −6
Original line number Diff line number Diff line
@@ -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);

Loading