Linux SPI subsystem development
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Andres Urian Florez <andres.emb.sys@gmail.com>, broonie@kernel.org
Cc: skhan@linuxfoundation.org, linux-spi@vger.kernel.org
Subject: Re: [PATCH] spi: offload: check offload ops existence before disabling the trigger
Date: Mon, 9 Jun 2025 08:46:16 -0500	[thread overview]
Message-ID: <756de913-e9c6-443b-844c-8b06eb00ab80@baylibre.com> (raw)
In-Reply-To: <20250608230422.325360-1-andres.emb.sys@gmail.com>

On 6/8/25 6:04 PM, Andres Urian Florez wrote:
> Add a safe guard in spi_offload_trigger to check the existence of
> offload->ops before invoking the trigger_disable callback
> 
> Signed-off-by: Andres Urian Florez <andres.emb.sys@gmail.com>
> ---
>  drivers/spi/spi-offload.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/spi/spi-offload.c b/drivers/spi/spi-offload.c
> index e674097bf3be..d336f4d228d5 100644
> --- a/drivers/spi/spi-offload.c
> +++ b/drivers/spi/spi-offload.c
> @@ -297,7 +297,7 @@ int spi_offload_trigger_enable(struct spi_offload *offload,
>  	if (trigger->ops->enable) {
>  		ret = trigger->ops->enable(trigger, config);
>  		if (ret) {
> -			if (offload->ops->trigger_disable)
> +			if (offload->ops && offload->ops->trigger_disable)
>  				offload->ops->trigger_disable(offload);
>  			return ret;
>  		}

It would be unusual to have an enable callback without also having
a disable callback, but to be symmetric with the same call in
spi_offload_trigger_disable(), it seems fine to add this check.

Reviewed-by: David Lechner <dlechner@baylibre.com>

  reply	other threads:[~2025-06-09 13:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-08 23:04 [PATCH] spi: offload: check offload ops existence before disabling the trigger Andres Urian Florez
2025-06-09 13:46 ` David Lechner [this message]
2025-06-09 15:40 ` Mark Brown

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=756de913-e9c6-443b-844c-8b06eb00ab80@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=andres.emb.sys@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.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