It looks like there is a bug somewhere that make the system panic
on resource releasing. I can't provide any evidence that devm_* is
related to the issue, but removing it seems to solve the problem
(or at least is not as frequent as before: I can load/unload 100 times
The problem was mitigated also by introducing delays (mdelay/printk)
in the fcl/gpio remove functions.
My guess is that MFD removal and devres clean up conflicts at some
point. MFD uses platform_unregister() which does resource_release(),
and because of devres, only after that we will release all resources
that we took on probe(). The flow does not sound right, we should
release resources we took **before** platform releases/remove the
resource from the system (not viceversa).
Signed-off-by: Federico Vaga <firstname.lastname@example.org>