Linux kernel staging patches
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Umang Jain <umang.jain@ideasonboard.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	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>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	kernel-list@raspberrypi.com, Stefan Wahren <wahrenst@gmx.net>
Subject: Re: [PATCH v2 4/6] staging: vchiq_core: Refactor notify_bulks()
Date: Fri, 11 Oct 2024 17:53:37 +0300	[thread overview]
Message-ID: <e366d563-3560-45f5-aff1-5291a5407c15@stanley.mountain> (raw)
In-Reply-To: <20241011120910.74045-5-umang.jain@ideasonboard.com>

On Fri, Oct 11, 2024 at 05:39:08PM +0530, Umang Jain wrote:
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> index e9cd012e2b5f..5509f8b1061a 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -1309,6 +1309,48 @@ get_bulk_reason(struct vchiq_bulk *bulk)
>  	return VCHIQ_BULK_RECEIVE_DONE;
>  }
>  
> +static int service_notify_bulk(struct vchiq_service *service,
> +			       struct vchiq_bulk *bulk)
> +{
> +	int status = -EINVAL;
> +
> +	if (!service || !bulk)
> +		return status;

Just return a literal here.  s/return status/return -EINVAL/.
This condition is impossible and the caller doesn't handle the error correctly.

> +
> +	if (bulk->actual != VCHIQ_BULK_ACTUAL_ABORTED) {
> +		if (bulk->dir == VCHIQ_BULK_TRANSMIT) {
> +			VCHIQ_SERVICE_STATS_INC(service, bulk_tx_count);
> +			VCHIQ_SERVICE_STATS_ADD(service, bulk_tx_bytes,
> +						bulk->actual);
> +		} else {
> +			VCHIQ_SERVICE_STATS_INC(service, bulk_rx_count);
> +			VCHIQ_SERVICE_STATS_ADD(service, bulk_rx_bytes,
> +						bulk->actual);
> +				}
> +	} else {
> +		VCHIQ_SERVICE_STATS_INC(service, bulk_aborted_count);
> +	}
> +
> +	if (bulk->mode == VCHIQ_BULK_MODE_BLOCKING) {
> +		struct bulk_waiter *waiter;
> +
> +		spin_lock(&service->state->bulk_waiter_spinlock);
> +		waiter = bulk->userdata;
> +		if (waiter) {
> +			waiter->actual = bulk->actual;
> +			complete(&waiter->event);
> +		}
> +
> +		spin_unlock(&service->state->bulk_waiter_spinlock);

We always return -EINVAL for VCHIQ_BULK_MODE_BLOCKING.

regards,
dan carpenter

> +	} else if (bulk->mode == VCHIQ_BULK_MODE_CALLBACK) {
> +		enum vchiq_reason reason = get_bulk_reason(bulk);
> +		status = make_service_callback(service, reason,	NULL,
> +					       bulk->userdata);
> +	}
> +
> +	return status;
> +}


  reply	other threads:[~2024-10-11 14:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 12:09 [PATCH v2 0/6] staging: vchiq: Lower indentation at various places Umang Jain
2024-10-11 12:09 ` [PATCH v2 1/6] staging: vchiq_core: Locally cache cache_line_size information Umang Jain
2024-10-11 12:09 ` [PATCH v2 2/6] staging: vchiq_core: Do not log debug in a separate scope Umang Jain
2024-10-11 12:09 ` [PATCH v2 3/6] staging: vchiq_core: Indent copy_message_data() on a single line Umang Jain
2024-10-11 12:09 ` [PATCH v2 4/6] staging: vchiq_core: Refactor notify_bulks() Umang Jain
2024-10-11 14:53   ` Dan Carpenter [this message]
2024-10-11 12:09 ` [PATCH v2 5/6] staging: vchiq_core: Lower indentation in parse_open() Umang Jain
2024-10-11 12:09 ` [PATCH v2 6/6] 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=e366d563-3560-45f5-aff1-5291a5407c15@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-list@raspberrypi.com \
    --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 \
    --cc=wahrenst@gmx.net \
    /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