From: Chris Packham <chris.packham@alliedtelesis.co.nz>
To: Wolfram Sang <wsa@kernel.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
Chris Packham <chris.packham@alliedtelesis.co.nz>
Subject: [PATCH v3 3/4] i2c: mpc: Remove redundant NULL check
Date: Tue, 13 Apr 2021 17:09:54 +1200 [thread overview]
Message-ID: <20210413050956.23264-4-chris.packham@alliedtelesis.co.nz> (raw)
In-Reply-To: <20210413050956.23264-1-chris.packham@alliedtelesis.co.nz>
In mpc_i2c_get_fdr_8xxx div is assigned as we iterate through the
mpc_i2c_dividers_8xxx array. By the time we exit the loop div will
either have the value that matches the requested speed or be pointing at
the last entry in mpc_i2c_dividers_8xxx. Checking for div being NULL
after the loop is redundant so remove the check.
Reported-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
drivers/i2c/busses/i2c-mpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 9818f9f6a553..c30687483147 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -377,7 +377,7 @@ static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
}
*real_clk = fsl_get_sys_freq() / prescaler / div->divider;
- return div ? (int)div->fdr : -EINVAL;
+ return (int)div->fdr;
}
static void mpc_i2c_setup_8xxx(struct device_node *node,
--
2.31.1
next prev parent reply other threads:[~2021-04-13 5:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 5:09 [PATCH v3 0/4] i2c: mpc: Refactor to improve responsiveness Chris Packham
2021-04-13 5:09 ` [PATCH v3 1/4] i2c: mpc: use device managed APIs Chris Packham
2021-04-13 12:21 ` Wolfram Sang
2021-04-13 13:31 ` Andy Shevchenko
2021-04-13 13:31 ` Andy Shevchenko
2021-04-13 5:09 ` [PATCH v3 2/4] i2c: mpc: Interrupt driven transfer Chris Packham
2021-04-13 12:22 ` Wolfram Sang
2021-04-13 13:52 ` Andy Shevchenko
2021-04-13 22:28 ` Chris Packham
2021-04-13 23:23 ` Chris Packham
2021-04-13 5:09 ` Chris Packham [this message]
2021-04-13 12:27 ` [PATCH v3 3/4] i2c: mpc: Remove redundant NULL check Wolfram Sang
2021-04-13 5:09 ` [PATCH v3 3/3] MAINTAINERS: Add Chris Packham as FREESCALE MPC I2C maintainer Chris Packham
2021-04-13 5:14 ` Chris Packham
2021-04-13 11:19 ` Andy Shevchenko
2021-04-13 5:09 ` [PATCH v3 4/4] " Chris Packham
2021-04-13 12:27 ` 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=20210413050956.23264-4-chris.packham@alliedtelesis.co.nz \
--to=chris.packham@alliedtelesis.co.nz \
--cc=andy.shevchenko@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@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).