Re: [PATCH v9 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset

Christoph Hellwig
2020-07-29T06:19:14Z

On Tue, Jul 28, 2020 at 02:24:51PM -0400, Jim Quinlan wrote:
> I started using devm_kcalloc() but at least two reviewers convinced me
> to just use kcalloc(). In addition, when I was using devm_kcalloc()
> it was awkward because 'dev' is not available to this function.
>
> It comes down to whether unbind/binding the device N times is actually
> a reasonable usage. As for my experience I've seen two cases: (1) my
> overnight "bind/unbind the PCIe RC driver" script, and we have a
> customer who does an unbind/bind as a hail mary to bring back life to
> their dead EP device. If the latter case happens repeatedly, there
> are bigger problems.

We can't just leak the allocations. Do you have a pointer to the
arguments against managed resources? I'm generally not a huge fan
of the managed resources, but for a case like this they actually seem
useful. If we don't use the managed resources we'll at leat need
to explicitly free the resources when freeing the device.