From: Hans de Goede <hansg@kernel.org>
To: Abdelrahman Fekry <abdelrahmanfekry375@gmail.com>,
mchehab@kernel.org, sakari.ailus@linux.intel.org,
andy@kernel.org, gregkh@linuxfoundation.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev,
linux-kernel-mentees@lists.linux.dev, skhan@linuxfoundation.org,
dan.carpenter@linaro.org
Subject: Re: [PATCH 1/2] staging: media: atomisp: return early on hmm_bo_device_init() failure
Date: Mon, 7 Jul 2025 16:12:11 +0200 [thread overview]
Message-ID: <00673c30-8233-417a-9f8b-2ab91381fa4d@kernel.org> (raw)
In-Reply-To: <20250707140923.58935-2-abdelrahmanfekry375@gmail.com>
Hi Abdelrahman,
On 7-Jul-25 16:09, Abdelrahman Fekry wrote:
> 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;
You need to add { } here otherwise the "return ret;" will
always get executed since it is not part of the code block
guarded by the if (despite the indentation).
Regards,
Hans
>
> hmm_initialized = true;
>
> @@ -48,7 +49,7 @@ int hmm_init(void)
> */
> dummy_ptr = hmm_alloc(1);
>
> - return ret;
> + return 0;
> }
>
> void hmm_cleanup(void)
next prev parent reply other threads:[~2025-07-07 14:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 14:09 [PATCH 0/2] staging: media: atomisp: clean up and unify HMM initialization logic Abdelrahman Fekry
2025-07-07 14:09 ` [PATCH 1/2] staging: media: atomisp: return early on hmm_bo_device_init() failure Abdelrahman Fekry
2025-07-07 14:12 ` Hans de Goede [this message]
2025-07-07 14:15 ` Abdelrahman Fekry
2025-07-14 19:13 ` Dan Carpenter
2025-07-14 20:11 ` Abdelrahman Fekry
2025-07-07 14:09 ` [PATCH 2/2] staging: media: atomisp: unify initialization flag usage in HMM Abdelrahman Fekry
2025-07-07 14:14 ` Hans de Goede
2025-07-07 15:01 ` Hans de Goede
2025-07-08 14:54 ` Abdelrahman Fekry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00673c30-8233-417a-9f8b-2ab91381fa4d@kernel.org \
--to=hansg@kernel.org \
--cc=abdelrahmanfekry375@gmail.com \
--cc=andy@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox