diff options
author | Jean Delvare <khali@linux-fr.org> | 2012-01-12 14:32:03 -0500 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2012-01-12 14:32:03 -0500 |
commit | 7c1f59c9d5caf3a84f35549b5d58f3c055a68da5 (patch) | |
tree | ff3ff814f1c2cbf7e5cd6244d9c5e4ddd5b4e2bd /drivers/i2c/busses/i2c-viapro.c | |
parent | a429638cac1e5c656818a45aaff78df7b743004e (diff) |
i2c: Fix error value returned by several bus drivers
When adding checks for ACPI resource conflicts to many bus drivers,
not enough attention was paid to the error paths, and for several
drivers this causes 0 to be returned on error in some cases. Fix this
by properly returning a non-zero value on every error.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@kernel.org
Diffstat (limited to 'drivers/i2c/busses/i2c-viapro.c')
-rw-r--r-- | drivers/i2c/busses/i2c-viapro.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 0b012f1f8ac5..58261d4725b6 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -324,7 +324,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev, | |||
324 | const struct pci_device_id *id) | 324 | const struct pci_device_id *id) |
325 | { | 325 | { |
326 | unsigned char temp; | 326 | unsigned char temp; |
327 | int error = -ENODEV; | 327 | int error; |
328 | 328 | ||
329 | /* Determine the address of the SMBus areas */ | 329 | /* Determine the address of the SMBus areas */ |
330 | if (force_addr) { | 330 | if (force_addr) { |
@@ -390,6 +390,7 @@ found: | |||
390 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " | 390 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " |
391 | "controller not enabled! - upgrade BIOS or " | 391 | "controller not enabled! - upgrade BIOS or " |
392 | "use force=1\n"); | 392 | "use force=1\n"); |
393 | error = -ENODEV; | ||
393 | goto release_region; | 394 | goto release_region; |
394 | } | 395 | } |
395 | } | 396 | } |
@@ -422,9 +423,11 @@ found: | |||
422 | "SMBus Via Pro adapter at %04x", vt596_smba); | 423 | "SMBus Via Pro adapter at %04x", vt596_smba); |
423 | 424 | ||
424 | vt596_pdev = pci_dev_get(pdev); | 425 | vt596_pdev = pci_dev_get(pdev); |
425 | if (i2c_add_adapter(&vt596_adapter)) { | 426 | error = i2c_add_adapter(&vt596_adapter); |
427 | if (error) { | ||
426 | pci_dev_put(vt596_pdev); | 428 | pci_dev_put(vt596_pdev); |
427 | vt596_pdev = NULL; | 429 | vt596_pdev = NULL; |
430 | goto release_region; | ||
428 | } | 431 | } |
429 | 432 | ||
430 | /* Always return failure here. This is to allow other drivers to bind | 433 | /* Always return failure here. This is to allow other drivers to bind |