Skip to content

Commit

Permalink
auxdisplay: cfag12864bfb: Convert to platform remove callback returni…
Browse files Browse the repository at this point in the history
…ng void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Uwe Kleine-König authored and Andy Shevchenko committed Mar 12, 2024
1 parent d8abf9d commit 07d0355
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/auxdisplay/cfag12864bfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,19 @@ static int cfag12864bfb_probe(struct platform_device *device)
return ret;
}

static int cfag12864bfb_remove(struct platform_device *device)
static void cfag12864bfb_remove(struct platform_device *device)
{
struct fb_info *info = platform_get_drvdata(device);

if (info) {
unregister_framebuffer(info);
framebuffer_release(info);
}

return 0;
}

static struct platform_driver cfag12864bfb_driver = {
.probe = cfag12864bfb_probe,
.remove = cfag12864bfb_remove,
.remove_new = cfag12864bfb_remove,
.driver = {
.name = CFAG12864BFB_NAME,
},
Expand Down

0 comments on commit 07d0355

Please sign in to comment.