]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rtc: tps6594: Fix memleak in probe
authorRichard Genoud <richard.genoud@bootlin.com>
Tue, 18 Jun 2024 14:18:49 +0000 (16:18 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 27 Jun 2024 22:18:55 +0000 (00:18 +0200)
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: 9f67c1e63976 ("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>
drivers/rtc/rtc-tps6594.c

index 838ae8562a351f31f0e32d51bf751f184a92f491..bc8dc735aa2384846496cfe220222f81a449da2b 100644 (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);