Skip to content

Commit ceda408

Browse files
Xion Wanggregkh
authored andcommitted
misc: remove ineffective WARN_ON() check from misc_deregister()
The WARN_ON(list_empty(&misc->list)) in misc_deregister() does not catch any practical error conditions: - For statically allocated miscdevice structures, the list pointers are zero-initialized, so list_empty() returns false, not true. - After list_del(), the pointers are set to LIST_POISON1 and LIST_POISON2, so repeated deregistration also fails to trigger the check. Signed-off-by: Xion Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 20f2044 commit ceda408

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/char/misc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,6 @@ EXPORT_SYMBOL(misc_register);
283283

284284
void misc_deregister(struct miscdevice *misc)
285285
{
286-
if (WARN_ON(list_empty(&misc->list)))
287-
return;
288-
289286
mutex_lock(&misc_mtx);
290287
list_del(&misc->list);
291288
device_destroy(&misc_class, MKDEV(MISC_MAJOR, misc->minor));

0 commit comments

Comments
 (0)