All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: check the return value of wakeup_source_register()
@ 2022-02-25 12:18 Jia-Ju Bai
  2022-02-25 16:54 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2022-02-25 12:18 UTC (permalink / raw)
  To: ulf.hansson, andriy.shevchenko, wsa+renesas,
	yoshihiro.shimoda.uh, adrian.hunter, swboyd, dev
  Cc: linux-mmc, linux-kernel, Jia-Ju Bai

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: core: check the return value of wakeup_source_register()
  2022-02-25 12:18 [PATCH] mmc: core: check the return value of wakeup_source_register() Jia-Ju Bai
@ 2022-02-25 16:54 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2022-02-25 16:54 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: ulf.hansson, wsa+renesas, yoshihiro.shimoda.uh, adrian.hunter,
	swboyd, dev, linux-mmc, linux-kernel

On Fri, Feb 25, 2022 at 04:18:58AM -0800, Jia-Ju Bai wrote:
> 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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-25 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 12:18 [PATCH] mmc: core: check the return value of wakeup_source_register() Jia-Ju Bai
2022-02-25 16:54 ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.