From: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
To: Ajay Gupta <ajayg@nvidia.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: aishwaryarj100@gmail.com
Subject: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
Date: Tue, 5 May 2020 20:22:30 +0530 [thread overview]
Message-ID: <20200505145230.17251-1-aishwaryarj100@gmail.com> (raw)
PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.
Generated by: scripts/coccinelle/api/ptr_ret.cocci
Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
---
drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index f5d25ce00f03..f480105000b8 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -277,10 +277,7 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq)
i2cd->gpu_ccgx_ucsi->irq = irq;
i2cd->gpu_ccgx_ucsi->properties = ccgx_props;
i2cd->ccgx_client = i2c_new_client_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi);
- if (IS_ERR(i2cd->ccgx_client))
- return PTR_ERR(i2cd->ccgx_client);
-
- return 0;
+ return PTR_ERR_OR_ZERO(i2cd->ccgx_client);
}
static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)
--
2.17.1
next reply other threads:[~2020-05-05 14:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 14:52 Aishwarya Ramakrishnan [this message]
2020-05-22 15:17 ` [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Wolfram Sang
2020-05-26 16:08 ` Ajay Gupta
2020-05-27 10:08 ` Wolfram Sang
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=20200505145230.17251-1-aishwaryarj100@gmail.com \
--to=aishwaryarj100@gmail.com \
--cc=ajayg@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).