From: Eddie James <eajames@linux.ibm.com>
To: openbmc@lists.ozlabs.org
Cc: joel@jms.id.au, andrew@aj.id.au, Eddie James <eajames@linux.ibm.com>
Subject: [PATCH linux dev-5.2 v2 2/4] i2c: Aspeed: Avoid invalid resource warning for byte mode
Date: Fri, 13 Sep 2019 11:15:51 -0500 [thread overview]
Message-ID: <1568391353-32584-3-git-send-email-eajames@linux.ibm.com> (raw)
In-Reply-To: <1568391353-32584-1-git-send-email-eajames@linux.ibm.com>
If the Aspeed I2C busses don't have the buffer memory specified in the
devicetree, the probe function will throw a warning for non-AST2500
SOCs. This is unnecessary and confusing since operating in byte mode
is perfectly valid. Avoid this by checking the resource pointer before
attempting to map it.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/i2c/busses/i2c-aspeed.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index 1943977..464c86a 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -1393,17 +1393,19 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
struct resource *res = platform_get_resource(pdev,
IORESOURCE_MEM, 1);
- bus->buf_base = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(bus->buf_base) || resource_size(res) < 2) {
- bus->buf_base = NULL;
- } else {
- bus->buf_size = resource_size(res);
- if (of_device_is_compatible(pdev->dev.of_node,
- "aspeed,ast2400-i2c-bus")) {
- bus->buf_page = ((res->start >> 8) &
- GENMASK(3, 0)) - 8;
- bus->buf_offset = (res->start >> 2) &
- ASPEED_I2CD_BUF_OFFSET_MASK;
+ if (res) {
+ bus->buf_base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(bus->buf_base) || resource_size(res) < 2) {
+ bus->buf_base = NULL;
+ } else {
+ bus->buf_size = resource_size(res);
+ if (of_device_is_compatible(pdev->dev.of_node,
+ "aspeed,ast2400-i2c-bus")) {
+ bus->buf_page = ((res->start >> 8) &
+ GENMASK(3, 0)) - 8;
+ bus->buf_offset = (res->start >> 2) &
+ ASPEED_I2CD_BUF_OFFSET_MASK;
+ }
}
}
}
--
1.8.3.1
next prev parent reply other threads:[~2019-09-13 16:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 16:15 [PATCH linux dev-5.2 v2 0/4] Aspeed: I2C: Add support for AST2600 Eddie James
2019-09-13 16:15 ` [PATCH linux dev-5.2 v2 1/4] i2c: Aspeed: Add AST2600 compatible Eddie James
2019-09-13 16:15 ` Eddie James [this message]
2019-09-13 16:15 ` [PATCH linux dev-5.2 v2 3/4] ARM: dts: Aspeed: ast2600: Add I2C busses Eddie James
2019-09-18 10:18 ` Cédric Le Goater
2019-09-18 14:53 ` Eddie James
2019-09-18 15:57 ` Cédric Le Goater
2019-09-18 17:02 ` Cédric Le Goater
2019-09-19 0:34 ` Ryan Chen
2019-09-13 16:15 ` [PATCH linux dev-5.2 v2 4/4] ARM: dts: Aspeed: Tacoma: Enable " Eddie James
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=1568391353-32584-3-git-send-email-eajames@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=openbmc@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.