Re: [PATCH] Infineon TPM: move infineon driver off pci_dev

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

 



Marcel Selhorst <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux