Re: [RESEND] pcmcia: vrc4173_cardu: Fix error path for pci_release_regions and pci_disable_device

2010-09-28 Thread Rahul Ruikar
anyone to review / accept ???
I could not find any particular maintainer for this patch through
"./scripts/get_maintainer.pl" except these 2 lists.

Regards,
Rahul Ruikar



On 26 September 2010 22:41, Rahul Ruikar  wrote:
> patchwork link not showing latest changes of RESEND patch. hence
> attaching in mail
> https://patchwork.kernel.org/patch/210152/
>
> - Rahul Ruikar
>
>
>
>
>
> On 26 September 2010 22:20, Rahul Ruikar  wrote:
>> - pci_release_regions called during return error path.
>> - pci_disable_device called for cases where earlier it was enabled.
>> - code duplication avoided/reduced by adding resource release at goto 
>> statements.
>>
>> Signed-off-by: Rahul Ruikar 
>> ---
>>  drivers/pcmcia/vrc4173_cardu.c |   58 
>> +++-
>>  1 files changed, 39 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/pcmcia/vrc4173_cardu.c b/drivers/pcmcia/vrc4173_cardu.c
>> index 9b3c158..c6d36b3 100644
>> --- a/drivers/pcmcia/vrc4173_cardu.c
>> +++ b/drivers/pcmcia/vrc4173_cardu.c
>> @@ -461,7 +461,7 @@ static int __devinit vrc4173_cardu_probe(struct pci_dev 
>> *dev,
>>  {
>>        vrc4173_socket_t *socket;
>>        unsigned long start, len, flags;
>> -       int slot, err;
>> +       int slot, err, ret;
>>
>>        slot = vrc4173_cardu_slots++;
>>        socket = &cardu_sockets[slot];
>> @@ -474,43 +474,63 @@ static int __devinit vrc4173_cardu_probe(struct 
>> pci_dev *dev,
>>                return err;
>>
>>        start = pci_resource_start(dev, 0);
>> -       if (start == 0)
>> -               return -ENODEV;
>> +       if (start == 0) {
>> +               ret = -ENODEV;
>> +               goto disable;
>> +       }
>>
>>        len = pci_resource_len(dev, 0);
>> -       if (len == 0)
>> -               return -ENODEV;
>> +       if (len == 0) {
>> +               ret = -ENODEV;
>> +               goto disable;
>> +       }
>>
>> -       if (((flags = pci_resource_flags(dev, 0)) & IORESOURCE_MEM) == 0)
>> -               return -EBUSY;
>> +       flags = pci_resource_flags(dev, 0);
>> +       if ((flags & IORESOURCE_MEM) == 0) {
>> +               ret = -EBUSY;
>> +               goto disable;
>> +       }
>>
>> -       if ((err = pci_request_regions(dev, socket->name)) < 0)
>> -               return err;
>> +       err = pci_request_regions(dev, socket->name);
>> +       if (err < 0) {
>> +               ret = err;
>> +               goto disable;
>> +       }
>>
>>        socket->base = ioremap(start, len);
>> -       if (socket->base == NULL)
>> -               return -ENODEV;
>> +       if (socket->base == NULL) {
>> +               ret = -ENODEV;
>> +               goto release;
>> +       }
>>
>>        socket->dev = dev;
>>
>>        socket->pcmcia_socket = pcmcia_register_socket(slot, 
>> &cardu_operations, 1);
>>        if (socket->pcmcia_socket == NULL) {
>> -               iounmap(socket->base);
>> -               socket->base = NULL;
>> -               return -ENOMEM;
>> +               ret =  -ENOMEM;
>> +               goto unmap;
>>        }
>>
>>        if (request_irq(dev->irq, cardu_interrupt, IRQF_SHARED, socket->name, 
>> socket) < 0) {
>> -               pcmcia_unregister_socket(socket->pcmcia_socket);
>> -               socket->pcmcia_socket = NULL;
>> -               iounmap(socket->base);
>> -               socket->base = NULL;
>> -               return -EBUSY;
>> +               ret = -EBUSY;
>> +               goto unregister;
>>        }
>>
>>        printk(KERN_INFO "%s at %#08lx, IRQ %d\n", socket->name, start, 
>> dev->irq);
>>
>>        return 0;
>> +
>> +unregister:
>> +       pcmcia_unregister_socket(socket->pcmcia_socket);
>> +       socket->pcmcia_socket = NULL;
>> +unmap:
>> +       iounmap(socket->base);
>> +       socket->base = NULL;
>> +release:
>> +       pci_release_regions(dev);
>> +disable:
>> +       pci_disable_device(dev);
>> +       return ret;
>>  }
>>
>>  static int __devinit vrc4173_cardu_setup(char *options)
>> --
>> 1.7.2.3
>>
>>
>

___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia


bug in addressspace?

2010-09-28 Thread Arne Zachlod

Hello!

currently I'm working on my own CardBus card and I test and debug it 
with your beautiful tools. I have seen that the Linux-system freezes if 
I plug in my card if I give the card these initial values for address 
spaces:


BAR0 - 0x 9011
BAR1 - 0x 9019
BAR2 - 0x 9021
BAR3 - 0x 9029
BAR4 - 0x 9031
BAR5 - 0x 9001

I know these values are completely bullsh*t but i think a system 
shouldn't get unstable ore freeze because you plug in something thats 
not covered by the specs.

I tested this with kernel 2.6.35.6.
I don't know which other informations you need, so please give me a list 
or something like this. If you like I could show you some kind of 
LogicAnalyzer output of the situation (you can probably see there what 
data got transferred). dmesg and lspci is not possible because the 
complete PC freezes in that situation.


Regards,
Arne



___
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia