aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-sis630.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2012-01-12 14:32:03 -0500
committerJean Delvare <khali@endymion.delvare>2012-01-12 14:32:03 -0500
commit7c1f59c9d5caf3a84f35549b5d58f3c055a68da5 (patch)
treeff3ff814f1c2cbf7e5cd6244d9c5e4ddd5b4e2bd /drivers/i2c/busses/i2c-sis630.c
parenta429638cac1e5c656818a45aaff78df7b743004e (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-sis630.c')
-rw-r--r--drivers/i2c/busses/i2c-sis630.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index e6f539e26f65..b617fd068ac7 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -393,7 +393,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
393{ 393{
394 unsigned char b; 394 unsigned char b;
395 struct pci_dev *dummy = NULL; 395 struct pci_dev *dummy = NULL;
396 int retval = -ENODEV, i; 396 int retval, i;
397 397
398 /* check for supported SiS devices */ 398 /* check for supported SiS devices */
399 for (i=0; supported[i] > 0 ; i++) { 399 for (i=0; supported[i] > 0 ; i++) {
@@ -418,18 +418,21 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
418 */ 418 */
419 if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) { 419 if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) {
420 dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n"); 420 dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n");
421 retval = -ENODEV;
421 goto exit; 422 goto exit;
422 } 423 }
423 /* if ACPI already enabled , do nothing */ 424 /* if ACPI already enabled , do nothing */
424 if (!(b & 0x80) && 425 if (!(b & 0x80) &&
425 pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) { 426 pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) {
426 dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n"); 427 dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n");
428 retval = -ENODEV;
427 goto exit; 429 goto exit;
428 } 430 }
429 431
430 /* Determine the ACPI base address */ 432 /* Determine the ACPI base address */
431 if (pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) { 433 if (pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) {
432 dev_err(&sis630_dev->dev, "Error: Can't determine ACPI base address\n"); 434 dev_err(&sis630_dev->dev, "Error: Can't determine ACPI base address\n");
435 retval = -ENODEV;
433 goto exit; 436 goto exit;
434 } 437 }
435 438
@@ -445,6 +448,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
445 sis630_driver.name)) { 448 sis630_driver.name)) {
446 dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already " 449 dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already "
447 "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA); 450 "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA);
451 retval = -EBUSY;
448 goto exit; 452 goto exit;
449 } 453 }
450 454