+ tpm-fix-error-handling.patch added to -mm tree

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

 



The patch titled

     tpm: fix error handling

has been added to the -mm tree.  Its filename is

     tpm-fix-error-handling.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: tpm: fix error handling
From: Jeff Garzik <jeff@xxxxxxxxxx>

- handle sysfs error
- handle driver model errors
- de-obfuscate platform_device_register_simple() call, which included an
  assignment in between two function calls, in the same C statement.

Signed-off-by: Jeff Garzik <jeff@xxxxxxxxxx>
Acked-by: Kylene Hall <kjhall@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/char/tpm/tpm.c       |    9 ++++++++-
 drivers/char/tpm/tpm_atmel.c |   10 +++++-----
 drivers/char/tpm/tpm_nsc.c   |    6 ++++--
 3 files changed, 17 insertions(+), 8 deletions(-)

diff -puN drivers/char/tpm/tpm.c~tpm-fix-error-handling drivers/char/tpm/tpm.c
--- a/drivers/char/tpm/tpm.c~tpm-fix-error-handling
+++ a/drivers/char/tpm/tpm.c
@@ -1153,7 +1153,14 @@ struct tpm_chip *tpm_register_hardware(s
 
 	spin_unlock(&driver_lock);
 
-	sysfs_create_group(&dev->kobj, chip->vendor.attr_group);
+	if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
+		list_del(&chip->list);
+		put_device(dev);
+		clear_bit(chip->dev_num, dev_mask);
+		kfree(chip);
+		kfree(devname);
+		return NULL;
+	}
 
 	chip->bios_dir = tpm_bios_log_setup(devname);
 
diff -puN drivers/char/tpm/tpm_atmel.c~tpm-fix-error-handling drivers/char/tpm/tpm_atmel.c
--- a/drivers/char/tpm/tpm_atmel.c~tpm-fix-error-handling
+++ a/drivers/char/tpm/tpm_atmel.c
@@ -184,7 +184,9 @@ static int __init init_atmel(void)
 	unsigned long base;
 	struct  tpm_chip *chip;
 
-	driver_register(&atml_drv);
+	rc = driver_register(&atml_drv);
+	if (rc)
+		return rc;
 
 	if ((iobase = atmel_get_base_addr(&base, &region_size)) == NULL) {
 		rc = -ENODEV;
@@ -195,10 +197,8 @@ static int __init init_atmel(void)
 	    (atmel_request_region
 	     (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
 
-
-	if (IS_ERR
-	    (pdev =
-	     platform_device_register_simple("tpm_atmel", -1, NULL, 0))) {
+	pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0);
+	if (IS_ERR(pdev)) {
 		rc = PTR_ERR(pdev);
 		goto err_rel_reg;
 	}
diff -puN drivers/char/tpm/tpm_nsc.c~tpm-fix-error-handling drivers/char/tpm/tpm_nsc.c
--- a/drivers/char/tpm/tpm_nsc.c~tpm-fix-error-handling
+++ a/drivers/char/tpm/tpm_nsc.c
@@ -284,7 +284,7 @@ static struct device_driver nsc_drv = {
 static int __init init_nsc(void)
 {
 	int rc = 0;
-	int lo, hi;
+	int lo, hi, err;
 	int nscAddrBase = TPM_ADDR;
 	struct tpm_chip *chip;
 	unsigned long base;
@@ -297,7 +297,9 @@ static int __init init_nsc(void)
 			return -ENODEV;
 	}
 
-	driver_register(&nsc_drv);
+	err = driver_register(&nsc_drv);
+	if (err)
+		return err;
 
 	hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI);
 	lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO);
_

Patches currently in -mm which might be from jeff@xxxxxxxxxx are

kauditd_thread-warning-fix.patch
fix-up-a-multitude-of-acpi-compiler-warnings-on-x86_64.patch
drivers-base-bus-remove-indentation-level.patch
fs-partitions-check-add-sysfs-error-handling.patch
drm-fix-error-returns-sysfs-error-handling.patch
git-libata-all.patch
pci_module_init-conversion-for-pata_pdc2027x.patch
libata-return-sense-data-in-hdio_drive_cmd-ioctl.patch
libata-return-sense-data-in-hdio_drive_cmd-ioctl-tidy.patch
via-pata-controller-xfer-fixes.patch
ahci-ati-sb600-sata-support-for-various-modes.patch
git-mtd.patch
update-smc91x-driver-with-arm-versatile-board-info.patch
b44-fix-eeprom-endianess-issue.patch
forcedeth-hardirq-lockdep-warning.patch
forcedeth-power-management-support.patch
forcedeth-power-management-support-tidy.patch
remove-unnecessary-check-in-drivers-net-depcac.patch
8139too-force-media-setting-fix.patch
tulip-fix-shutdown-dma-irq-race.patch
r8169-driver-corega-support-patch.patch
git-pciseg.patch
tpm-fix-error-handling.patch
git-gccbug.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux