Commit 28e0c250 authored by Jacob Keller's avatar Jacob Keller Committed by Jakub Kicinski

devlink: use min_t to calculate data_size

The calculation for the data_size in the devlink_nl_read_snapshot_fill
function uses an if statement that is better expressed using the min_t
macro.
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c1d8e3fb
......@@ -6485,10 +6485,8 @@ static int devlink_nl_region_read_snapshot_fill(struct sk_buff *skb,
u32 data_size;
u8 *data;
if (end_offset - curr_offset < DEVLINK_REGION_READ_CHUNK_SIZE)
data_size = end_offset - curr_offset;
else
data_size = DEVLINK_REGION_READ_CHUNK_SIZE;
data_size = min_t(u32, end_offset - curr_offset,
DEVLINK_REGION_READ_CHUNK_SIZE);
data = &snapshot->data[curr_offset];
err = devlink_nl_cmd_region_read_chunk_fill(skb, devlink,
......
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