On Wed, Sep 25, 2019 at 8:55 PM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On 9/25/19 10:36 AM, Danil Kipnis wrote: > > On Mon, Sep 23, 2019 at 11:51 PM Bart Van Assche <bvanassche@xxxxxxx> wrote: > >> On 6/20/19 8:03 AM, Jack Wang wrote: > >>> +static void ibtrs_clt_dev_release(struct device *dev) > >>> +{ > >>> + /* Nobody plays with device references, so nop */ > >>> +} > >> > >> That comment sounds wrong. Have you reviewed all of the device driver > >> core code and checked that there is no code in there that manipulates > >> struct device refcounts? I think the code that frees struct ibtrs_clt > >> should be moved from free_clt() into the above function. > > > > We only use the device to create an entry under /sys/class. free_clt() > > is destroying sysfs first and unregisters the device afterwards. I > > don't really see the need to free from the callback instead... Will > > make it clear in the comment. > > There is plenty of code under drivers/base that calls get_device() and > put_device(). Are you sure that none of the code under drivers/base will > ever call get_device() and put_device() for the ibtrs client device? You mean how could multiple kernel modules share the same ibtrs session...? I really never thought that far... > Thanks, > > Bart. >