OSDN Git Service

watchdog: s3c2410: Make s3c2410_get_wdt_drv_data() return an int
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 7 Mar 2023 06:56:02 +0000 (07:56 +0100)
committerWim Van Sebroeck <wim@linux-watchdog.org>
Sat, 22 Apr 2023 10:53:55 +0000 (12:53 +0200)
commit16d477a1dba9f214d1229d0a122d6d3a9636aa79
tree63cd4923c008400047e53e2e5de37ae4855ecd15
parent0e89b2c9a2a6984af43d09de9d1bb44da9822ba2
watchdog: s3c2410: Make s3c2410_get_wdt_drv_data() return an int

This is a preparation for making more use of dev_err_probe(). The idea
is that s3c2410_get_wdt_drv_data() (as it's called only by .probe()) can
make effective use of dev_err_probe() only if it returns an int. For
that the assignment to wdt->drv_data has to happen in the function. The
caller can then just pass on the return value in the error case.

This seems to be nicer for the compiler: bloatometer reports for an
ARCH=arm s3c6400_defconfig build:

add/remove: 1/1 grow/shrink: 0/1 up/down: 4/-64 (-60)
Function                                     old     new   delta
__initcall__kmod_s3c2410_wdt__209_821_s3c2410wdt_driver_init6       -       4      +4
__initcall__kmod_s3c2410_wdt__209_819_s3c2410wdt_driver_init6       4       -      -4
s3c2410wdt_probe                            1332    1272     -60

There is no semantical change. (Just one minor difference: Before this
patch wdt->drv_data was always assigned, now that only happens in the
non-error case. That doesn't matter however as *wdt is freed in the
error case.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230307065603.2253054-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
drivers/watchdog/s3c2410_wdt.c