Skip to content

Commit 6bbfed7

Browse files
committed
utils.py: Combine an else + if into elif
As recently pointed out by ruff: utils.py:84:9: PLR5501 Consider using `elif` instead of `else` then `if` to remove one indentation level Signed-off-by: Nathan Chancellor <nathan@kernel.org>
1 parent 4d004f3 commit 6bbfed7

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

utils.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,16 @@ def get_full_kernel_path(kernel_location, image, arch=None):
4848
# If '-k' is a file, we can just use it directly
4949
if kernel_location.is_file():
5050
kernel = kernel_location
51-
# If not, we need to find it based on the kernel build directory
51+
# If the image is an uncompressed vmlinux or a UML image, it is in the
52+
# root of the build folder
53+
elif image in ("vmlinux", "linux"):
54+
kernel = kernel_location.joinpath(image)
55+
# Otherwise, it is in the architecture's boot directory
5256
else:
53-
# If the image is an uncompressed vmlinux or a UML image, it is in the
54-
# root of the build folder
55-
if image in ("vmlinux", "linux"):
56-
kernel = kernel_location.joinpath(image)
57-
# Otherwise, it is in the architecture's boot directory
58-
else:
59-
if not arch:
60-
die(f"Kernel image ('{image}') is in the arch/ directory but 'arch' was not provided!"
61-
)
62-
kernel = kernel_location.joinpath("arch", arch, "boot", image)
57+
if not arch:
58+
die(f"Kernel image ('{image}') is in the arch/ directory but 'arch' was not provided!"
59+
)
60+
kernel = kernel_location.joinpath("arch", arch, "boot", image)
6361

6462
if not kernel.exists():
6563
die(f"Kernel ('{kernel}') does not exist!")

0 commit comments

Comments
 (0)