diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-12-01 13:32:53 -0500 |
---|---|---|
committer | Peter Huewe <peterhuewe@gmx.de> | 2015-01-17 08:00:07 -0500 |
commit | ca16b7671365d71f29973ca6931be821780f592e (patch) | |
tree | 8d6e5e2292acfb553e9df04c43cc082ce5e6e09e | |
parent | 76182b6b008b694d095aec1e2eb6c07fae787128 (diff) |
tpm/tpm_i2c_stm_st33: Replace err/rc/ret by ret for a function return code
Some functions return err, rc or ret for a status code.
Return ret instead for all of them.
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
-rw-r--r-- | drivers/char/tpm/tpm_i2c_stm_st33.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c index 728611638d1c..d425fa1a25bc 100644 --- a/drivers/char/tpm/tpm_i2c_stm_st33.c +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c | |||
@@ -291,7 +291,7 @@ static int check_locality(struct tpm_chip *chip) | |||
291 | static int request_locality(struct tpm_chip *chip) | 291 | static int request_locality(struct tpm_chip *chip) |
292 | { | 292 | { |
293 | unsigned long stop; | 293 | unsigned long stop; |
294 | long rc; | 294 | long ret; |
295 | struct tpm_stm_dev *tpm_dev; | 295 | struct tpm_stm_dev *tpm_dev; |
296 | u8 data; | 296 | u8 data; |
297 | 297 | ||
@@ -301,15 +301,15 @@ static int request_locality(struct tpm_chip *chip) | |||
301 | return chip->vendor.locality; | 301 | return chip->vendor.locality; |
302 | 302 | ||
303 | data = TPM_ACCESS_REQUEST_USE; | 303 | data = TPM_ACCESS_REQUEST_USE; |
304 | rc = I2C_WRITE_DATA(tpm_dev, TPM_ACCESS, &data, 1); | 304 | ret = I2C_WRITE_DATA(tpm_dev, TPM_ACCESS, &data, 1); |
305 | if (rc < 0) | 305 | if (ret < 0) |
306 | goto end; | 306 | goto end; |
307 | 307 | ||
308 | if (chip->vendor.irq) { | 308 | if (chip->vendor.irq) { |
309 | rc = wait_for_serirq_timeout(chip, (check_locality | 309 | ret = wait_for_serirq_timeout(chip, (check_locality |
310 | (chip) >= 0), | 310 | (chip) >= 0), |
311 | chip->vendor.timeout_a); | 311 | chip->vendor.timeout_a); |
312 | if (rc > 0) | 312 | if (ret > 0) |
313 | return chip->vendor.locality; | 313 | return chip->vendor.locality; |
314 | } else { | 314 | } else { |
315 | stop = jiffies + chip->vendor.timeout_a; | 315 | stop = jiffies + chip->vendor.timeout_a; |
@@ -319,9 +319,9 @@ static int request_locality(struct tpm_chip *chip) | |||
319 | msleep(TPM_TIMEOUT); | 319 | msleep(TPM_TIMEOUT); |
320 | } while (time_before(jiffies, stop)); | 320 | } while (time_before(jiffies, stop)); |
321 | } | 321 | } |
322 | rc = -EACCES; | 322 | ret = -EACCES; |
323 | end: | 323 | end: |
324 | return rc; | 324 | return ret; |
325 | } /* request_locality() */ | 325 | } /* request_locality() */ |
326 | 326 | ||
327 | /* | 327 | /* |
@@ -388,14 +388,14 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, | |||
388 | wait_queue_head_t *queue) | 388 | wait_queue_head_t *queue) |
389 | { | 389 | { |
390 | unsigned long stop; | 390 | unsigned long stop; |
391 | long rc; | 391 | long ret; |
392 | u8 status; | 392 | u8 status; |
393 | 393 | ||
394 | if (chip->vendor.irq) { | 394 | if (chip->vendor.irq) { |
395 | rc = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status | 395 | ret = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status |
396 | (chip) & mask) == | 396 | (chip) & mask) == |
397 | mask), timeout); | 397 | mask), timeout); |
398 | if (rc > 0) | 398 | if (ret > 0) |
399 | return 0; | 399 | return 0; |
400 | } else { | 400 | } else { |
401 | stop = jiffies + timeout; | 401 | stop = jiffies + timeout; |
@@ -624,7 +624,7 @@ MODULE_PARM_DESC(power_mgt, "Power Management"); | |||
624 | static int | 624 | static int |
625 | tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | 625 | tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) |
626 | { | 626 | { |
627 | int err; | 627 | int ret; |
628 | u8 intmask; | 628 | u8 intmask; |
629 | struct tpm_chip *chip; | 629 | struct tpm_chip *chip; |
630 | struct st33zp24_platform_data *platform_data; | 630 | struct st33zp24_platform_data *platform_data; |
@@ -633,20 +633,20 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
633 | if (client == NULL) { | 633 | if (client == NULL) { |
634 | pr_info("%s: i2c client is NULL. Device not accessible.\n", | 634 | pr_info("%s: i2c client is NULL. Device not accessible.\n", |
635 | __func__); | 635 | __func__); |
636 | err = -ENODEV; | 636 | ret = -ENODEV; |
637 | goto end; | 637 | goto end; |
638 | } | 638 | } |
639 | 639 | ||
640 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 640 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
641 | dev_info(&client->dev, "client not i2c capable\n"); | 641 | dev_info(&client->dev, "client not i2c capable\n"); |
642 | err = -ENODEV; | 642 | ret = -ENODEV; |
643 | goto end; | 643 | goto end; |
644 | } | 644 | } |
645 | 645 | ||
646 | tpm_dev = devm_kzalloc(&client->dev, sizeof(struct tpm_stm_dev), | 646 | tpm_dev = devm_kzalloc(&client->dev, sizeof(struct tpm_stm_dev), |
647 | GFP_KERNEL); | 647 | GFP_KERNEL); |
648 | if (!tpm_dev) { | 648 | if (!tpm_dev) { |
649 | err = -ENOMEM; | 649 | ret = -ENOMEM; |
650 | goto _tpm_clean_answer; | 650 | goto _tpm_clean_answer; |
651 | } | 651 | } |
652 | 652 | ||
@@ -654,7 +654,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
654 | 654 | ||
655 | if (!platform_data) { | 655 | if (!platform_data) { |
656 | dev_info(&client->dev, "chip not available\n"); | 656 | dev_info(&client->dev, "chip not available\n"); |
657 | err = -ENODEV; | 657 | ret = -ENODEV; |
658 | goto _tpm_clean_answer; | 658 | goto _tpm_clean_answer; |
659 | } | 659 | } |
660 | 660 | ||
@@ -675,8 +675,8 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
675 | chip->vendor.locality = LOCALITY0; | 675 | chip->vendor.locality = LOCALITY0; |
676 | 676 | ||
677 | if (power_mgt) { | 677 | if (power_mgt) { |
678 | err = gpio_request(platform_data->io_lpcpd, "TPM IO_LPCPD"); | 678 | ret = gpio_request(platform_data->io_lpcpd, "TPM IO_LPCPD"); |
679 | if (err) | 679 | if (ret) |
680 | goto _gpio_init1; | 680 | goto _gpio_init1; |
681 | gpio_set_value(platform_data->io_lpcpd, 1); | 681 | gpio_set_value(platform_data->io_lpcpd, 1); |
682 | } | 682 | } |
@@ -684,23 +684,23 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
684 | if (interrupts) { | 684 | if (interrupts) { |
685 | init_completion(&tpm_dev->irq_detection); | 685 | init_completion(&tpm_dev->irq_detection); |
686 | if (request_locality(chip) != LOCALITY0) { | 686 | if (request_locality(chip) != LOCALITY0) { |
687 | err = -ENODEV; | 687 | ret = -ENODEV; |
688 | goto _tpm_clean_answer; | 688 | goto _tpm_clean_answer; |
689 | } | 689 | } |
690 | 690 | ||
691 | clear_interruption(tpm_dev); | 691 | clear_interruption(tpm_dev); |
692 | err = request_irq(client->irq, | 692 | ret = request_irq(client->irq, |
693 | &tpm_ioserirq_handler, | 693 | &tpm_ioserirq_handler, |
694 | IRQF_TRIGGER_HIGH, | 694 | IRQF_TRIGGER_HIGH, |
695 | "TPM SERIRQ management", chip); | 695 | "TPM SERIRQ management", chip); |
696 | if (err < 0) { | 696 | if (ret < 0) { |
697 | dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", | 697 | dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", |
698 | client->irq); | 698 | client->irq); |
699 | goto _irq_set; | 699 | goto _irq_set; |
700 | } | 700 | } |
701 | 701 | ||
702 | err = I2C_READ_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); | 702 | ret = I2C_READ_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); |
703 | if (err < 0) | 703 | if (ret < 0) |
704 | goto _irq_set; | 704 | goto _irq_set; |
705 | 705 | ||
706 | intmask |= TPM_INTF_CMD_READY_INT | 706 | intmask |= TPM_INTF_CMD_READY_INT |
@@ -710,18 +710,18 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
710 | | TPM_INTF_STS_VALID_INT | 710 | | TPM_INTF_STS_VALID_INT |
711 | | TPM_INTF_DATA_AVAIL_INT; | 711 | | TPM_INTF_DATA_AVAIL_INT; |
712 | 712 | ||
713 | err = I2C_WRITE_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); | 713 | ret = I2C_WRITE_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); |
714 | if (err < 0) | 714 | if (ret < 0) |
715 | goto _irq_set; | 715 | goto _irq_set; |
716 | 716 | ||
717 | intmask = TPM_GLOBAL_INT_ENABLE; | 717 | intmask = TPM_GLOBAL_INT_ENABLE; |
718 | err = I2C_WRITE_DATA(tpm_dev, (TPM_INT_ENABLE + 3), | 718 | ret = I2C_WRITE_DATA(tpm_dev, (TPM_INT_ENABLE + 3), |
719 | &intmask, 1); | 719 | &intmask, 1); |
720 | if (err < 0) | 720 | if (ret < 0) |
721 | goto _irq_set; | 721 | goto _irq_set; |
722 | 722 | ||
723 | err = I2C_READ_DATA(tpm_dev, TPM_INT_STATUS, &intmask, 1); | 723 | ret = I2C_READ_DATA(tpm_dev, TPM_INT_STATUS, &intmask, 1); |
724 | if (err < 0) | 724 | if (ret < 0) |
725 | goto _irq_set; | 725 | goto _irq_set; |
726 | 726 | ||
727 | chip->vendor.irq = interrupts; | 727 | chip->vendor.irq = interrupts; |
@@ -743,7 +743,7 @@ _tpm_clean_answer: | |||
743 | tpm_remove_hardware(chip->dev); | 743 | tpm_remove_hardware(chip->dev); |
744 | end: | 744 | end: |
745 | pr_info("TPM I2C initialisation fail\n"); | 745 | pr_info("TPM I2C initialisation fail\n"); |
746 | return err; | 746 | return ret; |
747 | } | 747 | } |
748 | 748 | ||
749 | /* | 749 | /* |
@@ -779,7 +779,6 @@ static int tpm_st33_i2c_pm_suspend(struct device *dev) | |||
779 | gpio_set_value(pin_infos->io_lpcpd, 0); | 779 | gpio_set_value(pin_infos->io_lpcpd, 0); |
780 | else | 780 | else |
781 | ret = tpm_pm_suspend(dev); | 781 | ret = tpm_pm_suspend(dev); |
782 | |||
783 | return ret; | 782 | return ret; |
784 | } /* tpm_st33_i2c_suspend() */ | 783 | } /* tpm_st33_i2c_suspend() */ |
785 | 784 | ||
@@ -807,7 +806,7 @@ static int tpm_st33_i2c_pm_resume(struct device *dev) | |||
807 | tpm_do_selftest(chip); | 806 | tpm_do_selftest(chip); |
808 | } | 807 | } |
809 | return ret; | 808 | return ret; |
810 | } /* tpm_st33_i2c_pm_resume() */ | 809 | } /* tpm_st33_i2c_pm_resume() */ |
811 | #endif | 810 | #endif |
812 | 811 | ||
813 | static const struct i2c_device_id tpm_st33_i2c_id[] = { | 812 | static const struct i2c_device_id tpm_st33_i2c_id[] = { |