Commit 2327960f authored by Andy Shevchenko's avatar Andy Shevchenko

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: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Tested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent a8fc3d58
...@@ -188,8 +188,16 @@ static struct attribute *linedisp_attrs[] = { ...@@ -188,8 +188,16 @@ static struct attribute *linedisp_attrs[] = {
}; };
ATTRIBUTE_GROUPS(linedisp); 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 = { static const struct device_type linedisp_type = {
.groups = linedisp_groups, .groups = linedisp_groups,
.release = linedisp_release,
}; };
/** /**
...@@ -253,7 +261,6 @@ void linedisp_unregister(struct linedisp *linedisp) ...@@ -253,7 +261,6 @@ void linedisp_unregister(struct linedisp *linedisp)
{ {
device_del(&linedisp->dev); device_del(&linedisp->dev);
del_timer_sync(&linedisp->timer); del_timer_sync(&linedisp->timer);
kfree(linedisp->message);
put_device(&linedisp->dev); put_device(&linedisp->dev);
} }
EXPORT_SYMBOL_GPL(linedisp_unregister); EXPORT_SYMBOL_GPL(linedisp_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment