From: Hans de Goede <hdegoede@redhat.com>
To: Kate Hsuan <hpa@redhat.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH 2/5] staging: media: atomisp: runtime: frame: remove #ifdef ISP2401
Date: Wed, 26 Apr 2023 13:34:34 +0200 [thread overview]
Message-ID: <2fd56895-3f2e-83d7-46d4-c97eaf72d9e8@redhat.com> (raw)
In-Reply-To: <20230425074841.29063-3-hpa@redhat.com>
Hi Kate,
On 4/25/23 09:48, Kate Hsuan wrote:
> The actions of ISP2401 and 2400 are determined at the runtime.
>
> Signed-off-by: Kate Hsuan <hpa@redhat.com>
> ---
> .../media/atomisp/pci/runtime/frame/src/frame.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
> index 83bb42e05421..425e75f7dda7 100644
> --- a/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
> +++ b/drivers/staging/media/atomisp/pci/runtime/frame/src/frame.c
> @@ -601,9 +601,9 @@ static void frame_init_qplane6_planes(struct ia_css_frame *frame)
>
> static int frame_allocate_buffer_data(struct ia_css_frame *frame)
> {
> -#ifdef ISP2401
> - IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes);
> -#endif
> + if (IS_ISP2401)
> + IA_CSS_ENTER_LEAVE_PRIVATE("frame->data_bytes=%d\n", frame->data_bytes);
> +
> frame->data = hmm_alloc(frame->data_bytes);
> if (frame->data == mmgr_NULL)
> return -ENOMEM;
This is just a debug log message, IMHO it is best to just completely remove
the message for both ISP models.
> @@ -635,11 +635,10 @@ static int frame_allocate_with_data(struct ia_css_frame **frame,
>
> if (err) {
> kvfree(me);
> -#ifndef ISP2401
> - return err;
> -#else
> - me = NULL;
> -#endif
> + if (IS_ISP2401)
> + me = NULL;
> + else
> + return err;
> }
>
> *frame = me;
This one is also weird. I have checked the only caller of this and it
does not matter what *frame is set to since as long as this returns
non 0 the *frame is ignored and the functions always returns err
(just outside of the context of the patch).
So this can be simplified to just:
if (err) {
kvfree(me);
me = NULL;
}
And then fall through to the original code of:
*frame = me;
return err;
}
The me = NULL is not strictly necessary but setting *frame = NULL
on errors is a bit cleaner and may help catch future bugs.
Regards,
Hans
next prev parent reply other threads:[~2023-04-26 11:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 7:48 [PATCH 0/5] staging: media: atomisp: Remove #ifdef 2401 Kate Hsuan
2023-04-25 7:48 ` [PATCH 1/5] staging: media: atomisp: sh_css: Remove #ifdef ISP2401 Kate Hsuan
2023-04-26 11:25 ` Hans de Goede
2023-04-25 7:48 ` [PATCH 2/5] staging: media: atomisp: runtime: frame: remove " Kate Hsuan
2023-04-26 11:34 ` Hans de Goede [this message]
2023-04-25 7:48 ` [PATCH 3/5] staging: media: atomisp: sh_css_sp: Remove " Kate Hsuan
2023-04-26 12:08 ` Hans de Goede
2023-04-25 7:48 ` [PATCH 4/5] staging: media: atomisp: sh_css_firmware: determine firmware version at runtime Kate Hsuan
2023-04-26 12:08 ` Hans de Goede
2023-04-25 7:48 ` [PATCH 5/5] staging: media: atomisp: sh_css_mipi: Remove #ifdef 2041 Kate Hsuan
2023-04-26 12:16 ` Hans de Goede
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=2fd56895-3f2e-83d7-46d4-c97eaf72d9e8@redhat.com \
--to=hdegoede@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@redhat.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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