Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1348072

Re: [PATCH] wan: lmc: Switch to using managed resources

From Amitoj Kaur Chawla <amitoj1606@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] wan: lmc: Switch to using managed resources
Date 2016-03-02 15:30 +0100
Message-ID <r8fWN-pB-9@gated-at.bofh.it> (permalink)
References <r6Qxs-6i3-21@gated-at.bofh.it> <r80XO-6Zi-63@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 2, 2016 at 3:51 AM, David Miller <davem@davemloft.net> wrote:
> From: Amitoj Kaur Chawla <amitoj1606@gmail.com>
> Date: Sat, 27 Feb 2016 22:34:16 +0530
>
>> @@ -835,23 +835,20 @@ static int lmc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>>       err = pci_request_regions(pdev, "lmc");
>>       if (err) {
>>               printk(KERN_ERR "lmc: pci_request_region failed\n");
>> -             goto err_req_io;
>> +             return err;
>>       }
>>
>>       /*
>>        * Allocate our own device structure
>>        */
>> -     sc = kzalloc(sizeof(lmc_softc_t), GFP_KERNEL);
>> -     if (!sc) {
>> -             err = -ENOMEM;
>> -             goto err_kzalloc;
>
> You can't get rid of the error paths from here on out, because you still need to
> release the PCI regions obtained from pci_request_regions() above.
>
> To be quite honest, unless you are fixing real bugs, managed resource
> converstions are more likely to add bugs than do anything truly
> useful.
>
> I strongly consider you just drop this change.

Hi David,

I checked pcim_enable_device() before sending the patch, it has a call
to pcim_release() which does disabling of the PCI device and the
releasing of PCI regions obtained from pci_request_regions so there is
no need for pci_release_regions or pci_disable_device anymore.

Specifically, pcim_release contains the following code:

for (i = 0; i < DEVICE_COUNT_RESOURCE; i++)
  if (this->region_mask & (1 << i))
    pci_release_region(dev, i);

Also, commit id add243d5bc371eef66f81c9da4fd4b55a18dad23 is a similar
change that further made me believe that the change is a correct one.

However, if you think I am wrong somewhere and I understood things
incorrectly, please correct me.

Thanks,
Amitoj

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] wan: lmc: Switch to using managed resources Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-02-27 18:10 +0100
  Re: [PATCH] wan: lmc: Switch to using managed resources David Miller <davem@davemloft.net> - 2016-03-01 23:30 +0100
    Re: [PATCH] wan: lmc: Switch to using managed resources Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-03-02 15:30 +0100
      Re: [PATCH] wan: lmc: Switch to using managed resources David Miller <davem@davemloft.net> - 2016-03-02 19:50 +0100

csiph-web