All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai Song <songkai01@inspur.com>
To: <thor.thayer@linux.intel.com>, <lee.jones@linaro.org>
Cc: <zou_wei@huawei.com>, <linux-kernel@vger.kernel.org>,
	Kai Song <songkai01@inspur.com>
Subject: [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function
Date: Wed, 6 Oct 2021 22:19:26 +0800	[thread overview]
Message-ID: <20211006141926.6120-1-songkai01@inspur.com> (raw)

Fixes: d12edf9661a4 ("mfd: altera-sysmgr: Use resource_size function on resource object")

The resource_size defines that:
	res->end - res->start + 1;
The origin original code is:
	sysmgr_config.max_register = res->end - res->start - 3;

So, the correct fix is that:
	sysmgr_config.max_register = resource_size(res) - 4;

Signed-off-by: Kai Song <songkai01@inspur.com>
---
 drivers/mfd/altera-sysmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index 20cb294c7512..5d3715a28b28 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -153,7 +153,7 @@ static int sysmgr_probe(struct platform_device *pdev)
 		if (!base)
 			return -ENOMEM;
 
-		sysmgr_config.max_register = resource_size(res) - 3;
+		sysmgr_config.max_register = resource_size(res) - 4;
 		regmap = devm_regmap_init_mmio(dev, base, &sysmgr_config);
 	}
 
-- 
2.27.0


             reply	other threads:[~2021-10-06 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 14:19 Kai Song [this message]
2021-10-18 14:02 ` [PATCH] mfd: altera-sysmgr: Fix a mistake caused by resource_size function Lee Jones

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=20211006141926.6120-1-songkai01@inspur.com \
    --to=songkai01@inspur.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thor.thayer@linux.intel.com \
    --cc=zou_wei@huawei.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 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.