Re: [PATCH v6 06/33] of/device: Move dma_range_map before of_iommu_configure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2021-01-14 at 13:27 -0600, Rob Herring wrote:
> On Mon, Jan 11, 2021 at 07:18:47PM +0800, Yong Wu wrote:
> > "dev->dma_range_map" contains the devices' dma_ranges information,
> > This patch moves dma_range_map before of_iommu_configure. The iommu
> > driver may need to know the dma_address requirements of its iommu
> > consumer devices.
> > 
> > CC: Rob Herring <robh+dt@xxxxxxxxxx>
> > CC: Frank Rowand <frowand.list@xxxxxxxxx>
> > Signed-off-by: Yong Wu <yong.wu@xxxxxxxxxxxx>
> > ---
> >  drivers/of/device.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/of/device.c b/drivers/of/device.c
> > index aedfaaafd3e7..1d84636149df 100644
> > --- a/drivers/of/device.c
> > +++ b/drivers/of/device.c
> > @@ -170,9 +170,11 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
> >  	dev_dbg(dev, "device is%sdma coherent\n",
> >  		coherent ? " " : " not ");
> >  
> > +	dev->dma_range_map = map;
> >  	iommu = of_iommu_configure(dev, np, id);
> >  	if (PTR_ERR(iommu) == -EPROBE_DEFER) {
> >  		kfree(map);
> > +		dev->dma_range_map = NULL;
> 
> Not really going to matter, but you should probably clear dma_range_map 
> before what it points to is freed.
> 
> With that,
> 
> Reviewed-by: Rob Herring <robh@xxxxxxxxxx>

Thanks for the review. I will move it before "kfree(map)" in next
version.

> 
> >  		return -EPROBE_DEFER;
> >  	}
> >  
> > @@ -181,7 +183,6 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
> >  
> >  	arch_setup_dma_ops(dev, dma_start, size, iommu, coherent);
> >  
> > -	dev->dma_range_map = map;
> >  	return 0;
> >  }
> >  EXPORT_SYMBOL_GPL(of_dma_configure_id);
> > -- 
> > 2.18.0
> > 





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux