devlink: find snapshot in devlink_nl_cmd_region_read_dumpit
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 28 Nov 2022 20:36:41 +0000 (12:36 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Dec 2022 04:54:30 +0000 (20:54 -0800)
commite004ea10599d1a8279e959c86e63fc9d0bf2032b
treec9aaf2933e64c82ae28d982105cf9844247d7c58
parent611fd12ce0fbc809d5e54febb1f39e93532c9deb
devlink: find snapshot in devlink_nl_cmd_region_read_dumpit

The snapshot pointer is obtained inside of the function
devlink_nl_region_read_snapshot_fill. Simplify this function by locating
the snapshot upfront in devlink_nl_cmd_region_read_dumpit instead. This
aligns with how other netlink attributes are handled, and allows us to
exit slightly earlier if an invalid snapshot ID is provided.

It also allows us to pass the snapshot pointer directly to the
devlink_nl_region_read_snapshot_fill, and remove the now unused attrs
parameter.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/devlink.c