[PATCH v7 0/1] media: saa7164: add ioremap return checks and cleanups

From: Wang Jun

Date: Mon Mar 16 2026 - 08:24:22 EST


Hi Markus,

This v4 addressed all your comments:
- Added `Cc: stable@xxxxxxxxxxxxxxx` to
ensure the fix reaches stable kernels.
- Refactored the duplicate ioremap error handling into a helper function
to improve code clarity and reduce duplication.
- Replaced manual mutex lock/unlock with `scoped_guard()` for better
safety and readability.

After submitting v4 (which became v5 in the patchwork series due to
a version bump), the Media CI robot detected two issues:
- Build errors caused by incorrect struct member names
(`immio` → `lmmio`, `pci_dev` → `pci`).
- Two checkpatch `CHECK` warnings about alignment of function call
arguments (open parenthesis alignment).

This v6 fixes those issues:
- Corrected the member names to match the actual struct definitions.
- Adjusted the code alignment in the `release_resources()` helper to
satisfy `checkpatch.pl --strict`.

This v7 addresses two additional issues that were identified
in the v6 submission:
Corrected a remaining instance where dev->lmmio was used
instead of the correct dev->lmmio2 in the foo_bar() function.

Regarding the `Fixes` tag: I've added a tag pointing to the
commit that originally introduced the driver.
At that time, the file
was located at drivers/media/video/saa7164/saa7164-core.c; the `Fixes` tag
correctly identifies the commit where the issue first appeared, regardless
of the later file move.

The patch adds missing error checks for two ioremap calls in
saa7164_dev_setup(). If either mapping fails, the function now properly
releases previously allocated PCI resources, removes the device from the
global list, and returns -ENODEV. This prevents potential null pointer
dereferences and ensures proper cleanup on failure.

Please review the updated patch. Thanks!

Wang Jun (1):
media: saa7164: add ioremap return checks and cleanups

drivers/media/pci/saa7164/saa7164-core.c | 47 ++++++++++++++++++------
1 file changed, 35 insertions(+), 12 deletions(-)

--
2.43.0