Skip to content

Commit

Permalink
crypto: caam - dispose of IRQ mapping only after IRQ is freed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrey Smirnov authored and Herbert Xu committed Sep 9, 2019
1 parent 549077d commit f2ef960
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions drivers/crypto/caam/jr.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ static int caam_jr_remove(struct platform_device *pdev)
ret = caam_jr_shutdown(jrdev);
if (ret)
dev_err(jrdev, "Failed to shut down job ring\n");
irq_dispose_mapping(jrpriv->irq);

return ret;
}
Expand Down Expand Up @@ -487,6 +486,10 @@ static int caam_jr_init(struct device *dev)
return error;
}

static void caam_jr_irq_dispose_mapping(void *data)
{
irq_dispose_mapping((int)data);
}

/*
* Probe routine for each detected JobR subsystem.
Expand Down Expand Up @@ -542,12 +545,15 @@ static int caam_jr_probe(struct platform_device *pdev)
return -EINVAL;
}

error = devm_add_action_or_reset(jrdev, caam_jr_irq_dispose_mapping,
(void *)jrpriv->irq);
if (error)
return error;

/* Now do the platform independent part */
error = caam_jr_init(jrdev); /* now turn on hardware */
if (error) {
irq_dispose_mapping(jrpriv->irq);
if (error)
return error;
}

jrpriv->dev = jrdev;
spin_lock(&driver_data.jr_alloc_lock);
Expand Down

0 comments on commit f2ef960

Please sign in to comment.