Skip to contentSkip to conversation

spi: offload: check offload ops existence before disabling the trigger

PATCH In review Andres Urian Florez 3 participants 3 messages Jun 8, 2025 – Jun 9, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: offload: check offload ops existence before disabling the trigger

Add a safe guard in spi_offload_trigger to check the existence of offload->ops before invoking the trigger_disable callback

---
 drivers/spi/spi-offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-offload.c +1 -1
index e674097bf3be..d336f4d228d5 100644
@@ -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;
 		}
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Andres Urian Florez

Add a safe guard in spi_offload_trigger to check the existence of offload->ops before invoking the trigger_disable callback

---
 drivers/spi/spi-offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-offload.c +0 -0
index e674097bf3be..d336f4d228d5 100644

drivers/spi/spi-offload.c int spi_offload_trigger_enable(struct spi_offload *offload, · line 303

Quoted 8 lines
drivers/spi/spi-offload.c +1 -1
@@ -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.

maintainer
#2 lore raw
In reply to Andres Urian Florez
Quoted 4 lines · Andres Urian Florez

Add a safe guard in spi_offload_trigger to check the existence of offload->ops before invoking the trigger_disable callback

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: offload: check offload ops existence before disabling the trigger

      commit: e51a086117ed857ea455c9ea774dbfb82f53e517

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark