Re: [PATCH V3 1/2] PCI/DPC: Add local struct device

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

 



On Thu, Aug 17, 2017 at 07:48:24PM +0800, Dongdong Liu wrote:
> Use a local "struct device *dev" for brevity and consistency in DPC driver.
> No functional change intended.

I think there is a functional change here:

> @@ -119,10 +120,11 @@ static int dpc_probe(struct pcie_device *dev)
>  {
>  	struct dpc_dev *dpc;
>  	struct pci_dev *pdev = dev->port;
> +	struct device *device = &pdev->dev;
>  	int status;
>  	u16 ctl, cap;
>  
> -	dpc = devm_kzalloc(&dev->device, sizeof(*dpc), GFP_KERNEL);
> +	dpc = devm_kzalloc(device, sizeof(*dpc), GFP_KERNEL);
>  	if (!dpc)
>  		return -ENOMEM;

We were using the pcie_device's device for the devres API, but now it's
the pci_dev's. That will change the lifetime of memory allocations. I'm
not sure that it matters at th emoment, but it's certainly different.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux