Re: [PATCH 4/9] hwrng: omap - Use the managed device resource API for registration
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2016-09-08 17:02:42
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2016-09-08 17:02:42
On Thu, Sep 08, 2016 at 05:47:13PM +0200, Romain Perier wrote:
I was wondering something. hwrng_unregister does not check the kref reference counter of the object... so technically if the current rng_device is in use, with or without devm... calling platform->remove will break the driver anyway because hwrng_unregister will unbind the device from /dev/hwrng. What I mean is that I think that we had this issue even without devm_hwrng_register. Herbert, could you confirm ?
Right. remove can happen at any time and the driver needs to cope with it by returning an error from data_read if the hardware disappears in the middle of an operation. Cheers, -- Email: Herbert Xu [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt