Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: caam - dispose of IRQ mapping only after IRQ is freed

With IRQ requesting being managed by devres we need to make sure that
we dispose of IRQ mapping after and not before it is free'd (otherwise
we'll end up with a warning from the kernel). To achieve that simply
convert IRQ mapping to rely on devres as well.

Fixes: f314f12db65c ("crypto: caam - convert caam_jr_init() to use devres")
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Andrey Smirnov and committed by
Herbert Xu
f2ef9602 549077d7

+10 -4
+10 -4
drivers/crypto/caam/jr.c
··· 146 146 ret = caam_jr_shutdown(jrdev); 147 147 if (ret) 148 148 dev_err(jrdev, "Failed to shut down job ring\n"); 149 - irq_dispose_mapping(jrpriv->irq); 150 149 151 150 return ret; 152 151 } ··· 486 487 return error; 487 488 } 488 489 490 + static void caam_jr_irq_dispose_mapping(void *data) 491 + { 492 + irq_dispose_mapping((int)data); 493 + } 489 494 490 495 /* 491 496 * Probe routine for each detected JobR subsystem. ··· 545 542 return -EINVAL; 546 543 } 547 544 545 + error = devm_add_action_or_reset(jrdev, caam_jr_irq_dispose_mapping, 546 + (void *)jrpriv->irq); 547 + if (error) 548 + return error; 549 + 548 550 /* Now do the platform independent part */ 549 551 error = caam_jr_init(jrdev); /* now turn on hardware */ 550 - if (error) { 551 - irq_dispose_mapping(jrpriv->irq); 552 + if (error) 552 553 return error; 553 - } 554 554 555 555 jrpriv->dev = jrdev; 556 556 spin_lock(&driver_data.jr_alloc_lock);