Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9982024 authored by Colin Ian King's avatar Colin Ian King Committed by Alexandre Belloni
Browse files

rtc: sun6i: ensure rtc is kfree'd on error



The error return path on clk_data allocation failure does not kfree
the allocated rtc object. Fix this with a kfree of rtc on the error
exit path.

Detected by CoverityScan, CID#1452264 ("Resource Leak")

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 6f2a71a3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -201,8 +201,10 @@ static void __init sun6i_rtc_clk_init(struct device_node *node)

	clk_data = kzalloc(sizeof(*clk_data) + (sizeof(*clk_data->hws) * 2),
			   GFP_KERNEL);
	if (!clk_data)
	if (!clk_data) {
		kfree(rtc);
		return;
	}

	spin_lock_init(&rtc->lock);