[PATCH v2 3/8] accel/qaic: Add MHI controller

Stanislaw Gruszka stanislaw.gruszka at linux.intel.com
Fri Mar 3 13:57:35 UTC 2023


On Wed, Mar 01, 2023 at 09:09:57AM -0700, Jeffrey Hugo wrote:
> On 2/28/2023 4:52 AM, Stanislaw Gruszka wrote:
> > On Mon, Feb 06, 2023 at 08:41:40AM -0700, Jeffrey Hugo wrote:
> > > +	mhi_cntl = kzalloc(sizeof(*mhi_cntl), GFP_KERNEL);
> > [snip]
> > > +	mhi_cntl->irq = kmalloc(sizeof(*mhi_cntl->irq), GFP_KERNEL);
> > 
> > I recommend usage of devm_kzalloc(), devm_kmalloc() for those
> > to simplify error and exit paths.
> 
> When this was written, I didn't want to pass the struct device to the
> mhi_controller just for the purpose of using devm_*.  Today, I'm thinking
> that is not the end of the world, and devm has advantages. Will change.

If already available &pci_dev->dev can not be used in devm_ due to
different life times of pci_dev->dev and mhi_cntl, I don't think change
would be justifiable and kmalloc/kzalloc should stay.

Regards
Stanislaw



More information about the dri-devel mailing list