diff mbox series

spi: offload: remove unnecessary check on trigger->ops

Message ID 20250418171426.9868-1-andres.emb.sys@gmail.com
State New
Headers show
Series spi: offload: remove unnecessary check on trigger->ops | expand

Commit Message

Andres Urian Florez April 18, 2025, 5:14 p.m. UTC
Considering that trigger->ops = NULL happens only when the trigger is
being removed from the list, and at that point the operation is protected
with the spi_offload_triggers_lock, it is possible to remove the
!trigger->ops check because it will never be true in 
spi_offload_trigger_get()

Signed-off-by: Andres Urian Florez <andres.emb.sys@gmail.com>
---
 drivers/spi/spi-offload.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

David Lechner April 18, 2025, 7:50 p.m. UTC | #1
On 4/18/25 12:14 PM, Andres Urian Florez wrote:
> Considering that trigger->ops = NULL happens only when the trigger is
> being removed from the list, and at that point the operation is protected
> with the spi_offload_triggers_lock, it is possible to remove the
> !trigger->ops check because it will never be true in 
> spi_offload_trigger_get()
> 
> Signed-off-by: Andres Urian Florez <andres.emb.sys@gmail.com>
> ---

Thanks for the cleanup!

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

Patch

diff --git a/drivers/spi/spi-offload.c b/drivers/spi/spi-offload.c
index 6bad042fe437..c43264dc3900 100644
--- a/drivers/spi/spi-offload.c
+++ b/drivers/spi/spi-offload.c
@@ -183,9 +183,6 @@  static struct spi_offload_trigger
 
 	guard(mutex)(&trigger->lock);
 
-	if (!trigger->ops)
-		return ERR_PTR(-ENODEV);
-
 	if (trigger->ops->request) {
 		ret = trigger->ops->request(trigger, type, args->args, args->nargs);
 		if (ret)