From: Stefan Wahren <wahrenst@gmx.net>
To: Umang Jain <umang.jain@ideasonboard.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>
Cc: linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Kieran Bingham <kieran.bingham@ideasonboard.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH 6/8] staging: vchiq_arm: Lower indentation of a conditional block
Date: Fri, 11 Oct 2024 13:05:36 +0200 [thread overview]
Message-ID: <3822dfe4-6ea0-4934-8c7d-85a2433adff0@gmx.net> (raw)
In-Reply-To: <20241011072210.494672-7-umang.jain@ideasonboard.com>
Hi Umang,
Am 11.10.24 um 09:22 schrieb Umang Jain:
> Check early if we need to allocate the bulk waiter. This helps to
> improve readability and reduces the indentation of the 'if (waiter)'
> conditional block.
>
> No functional changes intended in this patch.
>
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
> .../interface/vchiq_arm/vchiq_arm.c | 34 +++++++++----------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 27ceaac8f6cc..a4a7f31b124a 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -564,28 +564,28 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
> }
> mutex_unlock(&instance->bulk_waiter_list_mutex);
>
> - if (waiter) {
> - struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
> -
> - if (bulk) {
> - /* This thread has an outstanding bulk transfer. */
> - /* FIXME: why compare a dma address to a pointer? */
> - if ((bulk->data != (dma_addr_t)(uintptr_t)data) || (bulk->size != size)) {
> - /*
> - * This is not a retry of the previous one.
> - * Cancel the signal when the transfer completes.
> - */
> - spin_lock(&service->state->bulk_waiter_spinlock);
> - bulk->userdata = NULL;
> - spin_unlock(&service->state->bulk_waiter_spinlock);
> - }
> - }
> - } else {
> + if (!waiter) {
> waiter = kzalloc(sizeof(*waiter), GFP_KERNEL);
> if (!waiter)
> return -ENOMEM;
> }
>
> + struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
I think this is a behavior change, which might lead to a null pointer
dereference in case waiter is freshly allocated.
Tbh I don't think indentation prevent us from unstaging this driver.
There are more important issues (e.g. resource leaks in probe error
paths or excessive usage of WARN) in this driver.
Regards
> +
> + if (bulk) {
> + /* This thread has an outstanding bulk transfer. */
> + /* FIXME: why compare a dma address to a pointer? */
> + if ((bulk->data != (dma_addr_t)(uintptr_t)data) || (bulk->size != size)) {
> + /*
> + * This is not a retry of the previous one.
> + * Cancel the signal when the transfer completes.
> + */
> + spin_lock(&service->state->bulk_waiter_spinlock);
> + bulk->userdata = NULL;
> + spin_unlock(&service->state->bulk_waiter_spinlock);
> + }
> + }
> +
> ret = vchiq_bulk_xfer_blocking(instance, handle, data, NULL, size,
> &waiter->bulk_waiter, dir);
> if ((ret != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
next prev parent reply other threads:[~2024-10-11 11:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 7:22 [PATCH 0/8] staging: vchiq: Lower indentation at various places Umang Jain
2024-10-11 7:22 ` [PATCH 1/8] staging: vchiq_core: Locally cache cache_line_size information Umang Jain
2024-10-11 7:22 ` [PATCH 2/8] staging: vchiq_core: Properly log dev_err() Umang Jain
2024-10-11 10:45 ` Stefan Wahren
2024-10-11 10:48 ` Umang Jain
2024-10-11 7:22 ` [PATCH 3/8] staging: vchiq_core: Do not log debug in a separate scope Umang Jain
2024-10-11 10:47 ` Stefan Wahren
2024-10-11 7:22 ` [PATCH 4/8] staging: vchiq_core: Lower indentation of a conditional block Umang Jain
2024-10-11 10:54 ` Stefan Wahren
2024-10-11 7:22 ` [PATCH 5/8] staging: vchiq_core: Indent copy_message_data() on a single line Umang Jain
2024-10-11 10:55 ` Stefan Wahren
2024-10-11 7:22 ` [PATCH 6/8] staging: vchiq_arm: Lower indentation of a conditional block Umang Jain
2024-10-11 11:05 ` Stefan Wahren [this message]
2024-10-11 7:22 ` [PATCH 7/8] staging: vchiq_core: Lower indentation in parse_open() Umang Jain
2024-10-11 11:07 ` Stefan Wahren
2024-10-11 7:22 ` [PATCH 8/8] staging: vchiq_core: Lower indentation in vchiq_close_service_internal Umang Jain
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=3822dfe4-6ea0-4934-8c7d-85a2433adff0@gmx.net \
--to=wahrenst@gmx.net \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=umang.jain@ideasonboard.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
all inboxes | Powered by JetHome®