diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2024-02-12 19:01:35 +0200 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2024-02-15 13:24:54 +0200 |
commit | 2327960f0c5ecd7a285e69284b6ec3fdbd2757be (patch) | |
tree | c9dadde749aa52f3abcac1c0bb3481494be3eb71 /drivers/auxdisplay | |
parent | a8fc3d587fa6de33c2ade327bd9d4fcbb16148f0 (diff) |
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.c | 9 |
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); |