[PATCH 1/2] staging: media: atomisp: return early on hmm_bo_device_init() failure

Abdelrahman Fekry
2025-07-07T14:10:15Z

hmm_init() would continue execution even if hmm_bo_device_init() failed,
potentially leading to bad behaviour when calling hmm_alloc().

- returns the error immediately if hmm_bo_device_init() fails.

Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index f998b57f90c4..c2ee9d2ec0d5 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -36,6 +36,7 @@ int hmm_init(void)
ISP_VM_START, ISP_VM_SIZE);
if (ret)
dev_err(atomisp_dev, "hmm_bo_device_init failed.\n");
+ return ret;

hmm_initialized = true;

@@ -48,7 +49,7 @@ int hmm_init(void)
*/
dummy_ptr = hmm_alloc(1);

- return ret;
+ return 0;
}

void hmm_cleanup(void)
--
2.25.1