aboutsummaryrefslogtreecommitdiff
path: root/drivers/auxdisplay
diff options
context:
space:
mode:
authorGravatar Andy Shevchenko <andriy.shevchenko@linux.intel.com> 2024-02-12 19:01:35 +0200
committerGravatar Andy Shevchenko <andriy.shevchenko@linux.intel.com> 2024-02-15 13:24:54 +0200
commit2327960f0c5ecd7a285e69284b6ec3fdbd2757be (patch)
treec9dadde749aa52f3abcac1c0bb3481494be3eb71 /drivers/auxdisplay
parentauxdisplay: img-ascii-lcd: Make container_of() no-op for struct linedisp (diff)
downloadlinux-2327960f0c5ecd7a285e69284b6ec3fdbd2757be.tar.gz
linux-2327960f0c5ecd7a285e69284b6ec3fdbd2757be.tar.bz2
linux-2327960f0c5ecd7a285e69284b6ec3fdbd2757be.zip
auxdisplay: linedisp: Free allocated resources in ->release()
While there is no issue currently with the resources allocation, the code may still be made more robust by deallocating message in the ->release() callback. Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/auxdisplay')
-rw-r--r--drivers/auxdisplay/line-display.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/auxdisplay/line-display.c b/drivers/auxdisplay/line-display.c
index 03e7f104aa1a..310e9bfb41ae 100644
--- a/drivers/auxdisplay/line-display.c
+++ b/drivers/auxdisplay/line-display.c
@@ -188,8 +188,16 @@ static struct attribute *linedisp_attrs[] = {
};
ATTRIBUTE_GROUPS(linedisp);
+static void linedisp_release(struct device *dev)
+{
+ struct linedisp *linedisp = container_of(dev, struct linedisp, dev);
+
+ kfree(linedisp->message);
+}
+
static const struct device_type linedisp_type = {
.groups = linedisp_groups,
+ .release = linedisp_release,
};
/**
@@ -253,7 +261,6 @@ void linedisp_unregister(struct linedisp *linedisp)
{
device_del(&linedisp->dev);
del_timer_sync(&linedisp->timer);
- kfree(linedisp->message);
put_device(&linedisp->dev);
}
EXPORT_SYMBOL_GPL(linedisp_unregister);