rtc: tps6594: Fix memleak in probe

BugLink: https://bugs.launchpad.net/bugs/2083196

[ Upstream commit 94d4154792abf30ee6081d35beaeef035816e294 ]

struct rtc_device is allocated twice in probe(), once with
devm_kzalloc(), and then with devm_rtc_allocate_device().

The allocation with devm_kzalloc() is lost and superfluous.

Fixes: 9f67c1e639 ("rtc: tps6594: Add driver for TPS6594 RTC")
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Link: https://lore.kernel.org/r/20240618141851.1810000-2-richard.genoud@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
Richard Genoud
2024-06-18 16:18:49 +02:00
committed by Mehmet Basaran
parent 0bcdc1f0cf
commit f6b65793c2
-4
View File
@@ -360,10 +360,6 @@ static int tps6594_rtc_probe(struct platform_device *pdev)
int irq;
int ret;
rtc = devm_kzalloc(dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)
return -ENOMEM;
rtc = devm_rtc_allocate_device(dev);
if (IS_ERR(rtc))
return PTR_ERR(rtc);