diff options
author | Jan Höppner <hoeppner@linux.ibm.com> | 2023-09-15 15:10:00 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-10-04 08:04:08 -0600 |
commit | f5f43aae6f336ae436759144a31879375e65ed28 (patch) | |
tree | 34f5311fe8ad7137444c7a68e36813b6f37d318d /drivers/irqchip/irq-riscv-intc.c | |
parent | d323c1a9477a82843795f10fb23f1634cea44007 (diff) | |
download | linux-f5f43aae6f336ae436759144a31879375e65ed28.tar.gz linux-f5f43aae6f336ae436759144a31879375e65ed28.tar.bz2 linux-f5f43aae6f336ae436759144a31879375e65ed28.zip |
partitions/ibm: Replace strncpy() and improve readability
strncpy() is deprecated and needs to be replaced. The volume label
information strings are not nul-terminated and strncpy() can simply be
replaced with memcpy().
To enhance the readability of find_label() alongside this change, the
following improvements are made:
- Introduce the array dasd_vollabels[] containing all information
necessary for the label detection.
- Provide a helper function to obtain an index value corresponding to a
volume label type. This allows the use of a switch statement to reduce
indentation levels.
- The 'temp' variable is used to check against valid volume label types.
In the good case, this variable already contains the volume label type
making it unnecessary to copy the information again from e.g.
label->vol.vollbl. Remove the 'temp' variable and the second copy as
all information are already provided.
- Remove the 'found' variable and replace it with early returns
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://lore.kernel.org/r/20230915131001.697070-3-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/irqchip/irq-riscv-intc.c')
0 files changed, 0 insertions, 0 deletions