Re: [PATCH v3 06/15] platform: goldfish: pipe: Move memory allocation from probe to init

From: Greg KH
Date: Mon Oct 15 2018 - 14:56:16 EST


On Mon, Oct 15, 2018 at 11:48:28AM -0700, Roman Kiryanov wrote:
> > You should only allocate memory at probe time
>
> probe does not know what memory to allocate. We have several versions
> of the driver (with different init) and different versions allocate
> different state.

I only see one driver here.

Why does probe not know what to allocate? That is exactly when the
device is bound to the driver, you have _way_ more information than you
do at init time.

> >, not init time as what
> > happens if the hardware is not present yet your driver is loaded?
>
> init will have to rollback what it allocated.

But those resources it will sit there wasted until unload happens. And
unload _never_ happens on a system unless you are a developer working on
the module.

thanks,

greg k-h