linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Peter Huewe <peterhuewe@gmx.de>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Thirupathaiah Annapureddy <thiruan@microsoft.com>,
	Sasha Levin <sashal@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fTPM: fix PTR_ERR() usage
Date: Fri, 12 Jul 2019 13:49:35 +0200	[thread overview]
Message-ID: <20190712114951.912328-1-arnd@arndb.de> (raw)

A last minute change must have confused PTR_ERR() and ERR_PTR():

drivers/char/tpm/tpm_ftpm_tee.c:236:15: error: incompatible pointer to integer conversion passing 'struct tee_context *' to parameter of type 'long' [-Werror,-Wint-conversion]
                if (ERR_PTR(pvt_data->ctx) == -ENOENT)
drivers/char/tpm/tpm_ftpm_tee.c:239:18: error: incompatible pointer to integer conversion passing 'struct tee_context *' to parameter of type 'long' [-Werror,-Wint-conversion]
                return ERR_PTR(pvt_data->ctx);

Fixes: c975c3911cc2 ("fTPM: firmware TPM running in TEE")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/char/tpm/tpm_ftpm_tee.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_ftpm_tee.c b/drivers/char/tpm/tpm_ftpm_tee.c
index 74766a4d3280..5679a5af9a96 100644
--- a/drivers/char/tpm/tpm_ftpm_tee.c
+++ b/drivers/char/tpm/tpm_ftpm_tee.c
@@ -233,10 +233,10 @@ static int ftpm_tee_probe(struct platform_device *pdev)
 	pvt_data->ctx = tee_client_open_context(NULL, ftpm_tee_match, NULL,
 						NULL);
 	if (IS_ERR(pvt_data->ctx)) {
-		if (ERR_PTR(pvt_data->ctx) == -ENOENT)
+		if (PTR_ERR(pvt_data->ctx) == -ENOENT)
 			return -EPROBE_DEFER;
 		dev_err(dev, "%s: tee_client_open_context failed\n", __func__);
-		return ERR_PTR(pvt_data->ctx);
+		return PTR_ERR(pvt_data->ctx);
 	}
 
 	/* Open a session with fTPM TA */
-- 
2.20.0


             reply	other threads:[~2019-07-12 11:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-12 11:49 Arnd Bergmann [this message]
2019-07-12 15:34 ` [PATCH] fTPM: fix PTR_ERR() usage Jarkko Sakkinen
2019-07-13 15:10   ` Sasha Levin
2019-07-14 14:38     ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190712114951.912328-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=sashal@kernel.org \
    --cc=thiruan@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).