lkml.org 
[lkml]   [2022]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mmc: core: check the return value of wakeup_source_register()
Date
The function wakeup_source_register() in mmc_alloc_host() can fail, so
its return value should be checked.

Fixes: b52fb259dff8 ("mmc: core: Always allow the card detect uevent to be consumed")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/mmc/core/host.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index cf140f4ec864..4f1a6db10ec5 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -550,6 +550,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)

dev_set_name(&host->class_dev, "mmc%d", host->index);
host->ws = wakeup_source_register(NULL, dev_name(&host->class_dev));
+ if (!host->ws) {
+ kfree(host);
+ return NULL;
+ }

host->parent = dev;
host->class_dev.parent = dev;
--
2.17.1
\
 
 \ /
  Last update: 2022-02-25 13:19    [W:3.768 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site