lkml.org 
[lkml]   [2005]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Infineon TPM: move infineon driver off pci_dev
Marcel Selhorst <selhorst@crypto.rub.de> wrote:
>
> @@ -489,67 +464,51 @@ static int __devinit tpm_inf_probe(struc
> "product id %02x%02x"
> "%s\n",
> TPM_INF_ADDR,
> - tpm_inf.base,
> + TPM_INF_BASE,
> version[0], version[1],
> vendorid[0], vendorid[1],
> productid[0], productid[1], chipname);
>
> - rc = tpm_register_hardware(&pci_dev->dev, &tpm_inf);
> - if (rc < 0)
> - goto error;
> + rc = tpm_register_hardware(&dev->dev, &tpm_inf);
> + if (rc < 0) {
> + release_region(tpm_inf.base, TPM_INF_PORT_LEN);
> + return -ENODEV;
> + }
> return 0;
> } else {
> - dev_info(&pci_dev->dev, "No Infineon TPM found!\n");
> -error:
> - pnp_unregister_driver(&tpm_inf_pnp);
> -error2:
> - pci_disable_device(pci_dev);
> - pnp_registered = 0;
> + dev_info(&dev->dev, "No Infineon TPM found!\n");
> return -ENODEV;
> }
> }

This final return will leak the I/O region from request_region().

To reduce the chance of this happening again, please send a followup patch
which prevents this function from having `return' statements sprinkled all
over it. An example would be drivers/net/8139cp.c:cp_init_one(), thanks.

If for some reason the leak is deliberate then a comment is needed.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-27 23:35    [W:0.058 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site