netconsole: Create a allocation helper
authorBreno Leitao <leitao@debian.org>
Fri, 11 Aug 2023 09:31:57 +0000 (02:31 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Aug 2023 02:25:42 +0000 (19:25 -0700)
commitb0a9e2c9a99f64e3c59e8a32a11b90c667201203
tree3e7a6c5c6a18a32a56733245a436c1b36e41f537
parentf3add6dec36d9d747929918ba1d7ce8866e1c054
netconsole: Create a allocation helper

De-duplicate the initialization and allocation code for struct
netconsole_target.

The same allocation and initialization code is duplicated in two
different places in the netconsole subsystem, when the netconsole target
is initialized by command line parameters (alloc_param_target()), and
dynamically by sysfs (make_netconsole_target()).

Create a helper function, and call it from the two different functions.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20230811093158.1678322-2-leitao@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netconsole.c