From patchwork Mon Dec 1 18:32:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Ricard X-Patchwork-Id: 416535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 73AF2140169 for ; Tue, 2 Dec 2014 05:33:48 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XvVn8-0003EG-CP; Mon, 01 Dec 2014 18:33:46 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XvVn6-0003Dy-Sd for tpmdd-devel@lists.sourceforge.net; Mon, 01 Dec 2014 18:33:44 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; envelope-from=christophe.ricard@gmail.com; helo=mail-wi0-f171.google.com; Received: from mail-wi0-f171.google.com ([209.85.212.171]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XvVn5-0005O3-Pw for tpmdd-devel@lists.sourceforge.net; Mon, 01 Dec 2014 18:33:44 +0000 Received: by mail-wi0-f171.google.com with SMTP id bs8so25576957wib.10 for ; Mon, 01 Dec 2014 10:33:37 -0800 (PST) X-Received: by 10.194.3.2 with SMTP id 2mr96940185wjy.89.1417458817830; Mon, 01 Dec 2014 10:33:37 -0800 (PST) Received: from localhost.localdomain (ax113-6-78-236-204-66.fbx.proxad.net. [78.236.204.66]) by mx.google.com with ESMTPSA id nj9sm29340378wic.10.2014.12.01.10.33.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 10:33:36 -0800 (PST) From: Christophe Ricard X-Google-Original-From: Christophe Ricard To: peterhuewe@gmx.de, ashley@ashleylai.com, tpmdd@selhorst.net Date: Mon, 1 Dec 2014 19:32:53 +0100 Message-Id: <1417458780-25977-9-git-send-email-christophe-h.ricard@st.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1417458780-25977-1-git-send-email-christophe-h.ricard@st.com> References: <1417458780-25977-1-git-send-email-christophe-h.ricard@st.com> X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (christophe.ricard[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1XvVn5-0005O3-Pw Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, christophe.ricard@gmail.com, jean-luc.blanc@st.com, tpmdd-devel@lists.sourceforge.net, christophe-h.ricard@st.com Subject: [tpmdd-devel] [PATCH v6 08/15] tpm/tpm_i2c_stm_st33: Replace err/rc/ret by ret for a function return code X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net Some functions return err, rc or ret for a status code. Return ret instead for all of them. Reviewed-by: Jason Gunthorpe Signed-off-by: Christophe Ricard --- drivers/char/tpm/tpm_i2c_stm_st33.c | 61 ++++++++++++++++++------------------- 1 file 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 7286116..d425fa1 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) static int request_locality(struct tpm_chip *chip) { unsigned long stop; - long rc; + long ret; struct tpm_stm_dev *tpm_dev; u8 data; @@ -301,15 +301,15 @@ static int request_locality(struct tpm_chip *chip) return chip->vendor.locality; data = TPM_ACCESS_REQUEST_USE; - rc = I2C_WRITE_DATA(tpm_dev, TPM_ACCESS, &data, 1); - if (rc < 0) + ret = I2C_WRITE_DATA(tpm_dev, TPM_ACCESS, &data, 1); + if (ret < 0) goto end; if (chip->vendor.irq) { - rc = wait_for_serirq_timeout(chip, (check_locality + ret = wait_for_serirq_timeout(chip, (check_locality (chip) >= 0), chip->vendor.timeout_a); - if (rc > 0) + if (ret > 0) return chip->vendor.locality; } else { stop = jiffies + chip->vendor.timeout_a; @@ -319,9 +319,9 @@ static int request_locality(struct tpm_chip *chip) msleep(TPM_TIMEOUT); } while (time_before(jiffies, stop)); } - rc = -EACCES; + ret = -EACCES; end: - return rc; + return ret; } /* request_locality() */ /* @@ -388,14 +388,14 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, wait_queue_head_t *queue) { unsigned long stop; - long rc; + long ret; u8 status; if (chip->vendor.irq) { - rc = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status + ret = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status (chip) & mask) == mask), timeout); - if (rc > 0) + if (ret > 0) return 0; } else { stop = jiffies + timeout; @@ -624,7 +624,7 @@ MODULE_PARM_DESC(power_mgt, "Power Management"); static int tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { - int err; + int ret; u8 intmask; struct tpm_chip *chip; struct st33zp24_platform_data *platform_data; @@ -633,20 +633,20 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) if (client == NULL) { pr_info("%s: i2c client is NULL. Device not accessible.\n", __func__); - err = -ENODEV; + ret = -ENODEV; goto end; } if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { dev_info(&client->dev, "client not i2c capable\n"); - err = -ENODEV; + ret = -ENODEV; goto end; } tpm_dev = devm_kzalloc(&client->dev, sizeof(struct tpm_stm_dev), GFP_KERNEL); if (!tpm_dev) { - err = -ENOMEM; + ret = -ENOMEM; goto _tpm_clean_answer; } @@ -654,7 +654,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) if (!platform_data) { dev_info(&client->dev, "chip not available\n"); - err = -ENODEV; + ret = -ENODEV; goto _tpm_clean_answer; } @@ -675,8 +675,8 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) chip->vendor.locality = LOCALITY0; if (power_mgt) { - err = gpio_request(platform_data->io_lpcpd, "TPM IO_LPCPD"); - if (err) + ret = gpio_request(platform_data->io_lpcpd, "TPM IO_LPCPD"); + if (ret) goto _gpio_init1; gpio_set_value(platform_data->io_lpcpd, 1); } @@ -684,23 +684,23 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) if (interrupts) { init_completion(&tpm_dev->irq_detection); if (request_locality(chip) != LOCALITY0) { - err = -ENODEV; + ret = -ENODEV; goto _tpm_clean_answer; } clear_interruption(tpm_dev); - err = request_irq(client->irq, + ret = request_irq(client->irq, &tpm_ioserirq_handler, IRQF_TRIGGER_HIGH, "TPM SERIRQ management", chip); - if (err < 0) { + if (ret < 0) { dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", client->irq); goto _irq_set; } - err = I2C_READ_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); - if (err < 0) + ret = I2C_READ_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); + if (ret < 0) goto _irq_set; intmask |= TPM_INTF_CMD_READY_INT @@ -710,18 +710,18 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) | TPM_INTF_STS_VALID_INT | TPM_INTF_DATA_AVAIL_INT; - err = I2C_WRITE_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); - if (err < 0) + ret = I2C_WRITE_DATA(tpm_dev, TPM_INT_ENABLE, &intmask, 1); + if (ret < 0) goto _irq_set; intmask = TPM_GLOBAL_INT_ENABLE; - err = I2C_WRITE_DATA(tpm_dev, (TPM_INT_ENABLE + 3), + ret = I2C_WRITE_DATA(tpm_dev, (TPM_INT_ENABLE + 3), &intmask, 1); - if (err < 0) + if (ret < 0) goto _irq_set; - err = I2C_READ_DATA(tpm_dev, TPM_INT_STATUS, &intmask, 1); - if (err < 0) + ret = I2C_READ_DATA(tpm_dev, TPM_INT_STATUS, &intmask, 1); + if (ret < 0) goto _irq_set; chip->vendor.irq = interrupts; @@ -743,7 +743,7 @@ _tpm_clean_answer: tpm_remove_hardware(chip->dev); end: pr_info("TPM I2C initialisation fail\n"); - return err; + return ret; } /* @@ -779,7 +779,6 @@ static int tpm_st33_i2c_pm_suspend(struct device *dev) gpio_set_value(pin_infos->io_lpcpd, 0); else ret = tpm_pm_suspend(dev); - return ret; } /* tpm_st33_i2c_suspend() */ @@ -807,7 +806,7 @@ static int tpm_st33_i2c_pm_resume(struct device *dev) tpm_do_selftest(chip); } return ret; -} /* tpm_st33_i2c_pm_resume() */ +} /* tpm_st33_i2c_pm_resume() */ #endif static const struct i2c_device_id tpm_st33_i2c_id[] = {