[PATCH] block: return NULL if request_module() failed in elevator_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If request_module() failed then it seems no reason to lookup
the iosched again, so add a check to handle this case.

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxx>
---
 block/elevator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/elevator.c b/block/elevator.c
index 8fdcd64ae12e..f89527951243 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -124,7 +124,9 @@ static struct elevator_type *elevator_get(struct request_queue *q,
 	e = elevator_find(name, q->mq_ops != NULL);
 	if (!e && try_loading) {
 		spin_unlock(&elv_list_lock);
-		request_module("%s-iosched", name);
+		if (request_module("%s-iosched", name))
+			return e;
+
 		spin_lock(&elv_list_lock);
 		e = elevator_find(name, q->mq_ops != NULL);
 	}
-- 
2.17.2




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux