From: Akinobu Mita Date: Tue, 17 Jul 2007 11:03:45 +0000 (-0700) Subject: unregister_blkdev(): do WARN_ON on failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=294462a5c6c4fb9a6ced9cb5a368ff335f1b656e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git unregister_blkdev(): do WARN_ON on failure When unregister_blkdev() has failed, something wrong happened. This patch adds WARN_ON to notify of such badness. Cc: Jens Axboe Signed-off-by: Akinobu Mita Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/block/genhd.c b/block/genhd.c index b321cadd6e65..7f71b2c472b8 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -120,9 +120,10 @@ int unregister_blkdev(unsigned int major, const char *name) for (n = &major_names[index]; *n; n = &(*n)->next) if ((*n)->major == major) break; - if (!*n || strcmp((*n)->name, name)) + if (!*n || strcmp((*n)->name, name)) { + WARN_ON(1); ret = -EINVAL; - else { + } else { p = *n; *n = p->next; }