On Thu, 7 May 2020 17:53:01 +0200 Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > Hi Boris, > > Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Thu, 7 May > 2020 17:24:53 +0200: > > > On Thu, 7 May 2020 17:13:11 +0200 > > Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > > > > > Hi Boris, > > > > > > Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Thu, 7 May > > > 2020 14:11:03 +0200: > > > > > > > On Thu, 7 May 2020 13:00:33 +0200 > > > > Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > > > > > > > > > > > > > + > > > > > +static void anfc_chips_cleanup(struct arasan_nfc *nfc) > > > > > +{ > > > > > + struct anand *anand, *tmp; > > > > > + > > > > > + list_for_each_entry_safe(anand, tmp, &nfc->chips, node) { > > > > > + nand_release(&anand->chip); > > > > > > > > ret = mtd_device_unregister(nand_to_mtd(&anand->chip)); > > > > WARN_ON(ret); > > > > nand_cleanup(&anand->chip); > > > > > > > > Or maybe add this WARN_ON() to nand_release() so we don't have to ask > > > > people to use mtd_device_unregister() + nand_cleanup(). > > > > > > I don't get your point here? I'm not against adding a warn_on between > > > both functions but it's not related to this driver? > > > > We've asked people to not call nand_release() but instead call > > mtd_device_unregister()+nand_cleanup(), which is not done here. My > > point is, if even us can't get it right, maybe it's a sign we should > > instead patch nand_release() to do the right thing. > > It's in my todo-list, yes. What about just dropping nand_release > entirely? So that nand_scan_tail as its nand cleanup and > mtd_device_register as its mtd_device_unregister and everything will be > much clearer? > Yep, that would work too.