public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] staging: media: atomisp: return early on hmm_bo_device_init() failure
@ 2025-07-08 16:44 Abdelrahman Fekry
  2025-07-08 16:44 ` [PATCH v2 2/2] staging: media: atomisp: unify HMM initialization tracking Abdelrahman Fekry
  0 siblings, 1 reply; 2+ messages in thread
From: Abdelrahman Fekry @ 2025-07-08 16:44 UTC (permalink / raw)
  To: hansg, mchehab, sakari.ailus, andy, gregkh
  Cc: linux-media, linux-kernel, linux-staging, linux-kernel-mentees,
	skhan, dan.carpenter, Abdelrahman Fekry

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.

Tested by:
- Building the Driver.
- Applying to media-committers [1] tree.

Link: https://gitlab.freedesktop.org/linux-media/media-committers.git [1]
Suggested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>
---
v2:
- put brackets around block code.

v1: https://lore.kernel.org/all/20250707140923.58935-2-abdelrahmanfekry375@gmail.com/
 drivers/staging/media/atomisp/pci/hmm/hmm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index f998b57f90c4..97c7ce970aef 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -34,8 +34,10 @@ int hmm_init(void)
 
 	ret = hmm_bo_device_init(&bo_device, &sh_mmu_mrfld,
 				 ISP_VM_START, ISP_VM_SIZE);
-	if (ret)
+	if (ret) {
 		dev_err(atomisp_dev, "hmm_bo_device_init failed.\n");
+		return ret;
+	}
 
 	hmm_initialized = true;
 
@@ -48,7 +50,7 @@ int hmm_init(void)
 	 */
 	dummy_ptr = hmm_alloc(1);
 
-	return ret;
+	return 0;
 }
 
 void hmm_cleanup(void)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-08 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 16:44 [PATCH v2 1/2] staging: media: atomisp: return early on hmm_bo_device_init() failure Abdelrahman Fekry
2025-07-08 16:44 ` [PATCH v2 2/2] staging: media: atomisp: unify HMM initialization tracking Abdelrahman Fekry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox