Skip to contentSkip to conversation

mmc: core: check the return value of wakeup_source_register()

PATCH NAK Jia-Ju Bai 2 participants 2 messages Feb 25, 2022 MMC, SD and SDIO

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 mmc: core: check the return value of wakeup_source_register()

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")
---
 drivers/mmc/core/host.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/host.c +4 -0
index cf140f4ec864..4f1a6db10ec5 100644
@@ -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;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Jia-Ju Bai

The function wakeup_source_register() in mmc_alloc_host() can fail, so its return value should be checked.

NAK.

This doesn't explain why this resource must be non-optional.

One should not dumbly use the robots.

Signature · 2 lines
With Best Regards,
Andy Shevchenko