On Mon, Apr 13, 2020 at 09:23:22AM -0400, Jeff Layton wrote: > > > I don't see a problem with having a "free" routine ignore IS_ERR values > > > just like it does NULL values. How about I just trim off the other > > > deltas in this patch? Something like this? > > > > I think it encourages fragile code. Less so than functions that > > return pointer, NULL or IS_ERR pointer, but still. You yourself > > almost fell into one of these traps while editing debugfs.c ;) > > > > We'll have to agree to disagree here. Having a free routine ignore > ERR_PTR values seems perfectly reasonable to me. Freeing things which haven't been allocated is a constant source bugs. err: kfree(foo->bar); kfree(foo); Oops... "foo" wasn't allocated so the first line will crash. Every other day someone commits code like that. regards, dan carpenter