public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Deepak R Varma <drv@mailo.com>
To: Yinbo Zhu <zhuyinbo@loongson.cn>,
	loongarch@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: Saurabh Singh Sengar <ssengar@microsoft.com>,
	Praveen Kumar <kumarpraveen@linux.microsoft.com>,
	drv@mailo.com
Subject: [PATCH] soc: loongson: use resource_size() helper function
Date: Fri, 23 Dec 2022 03:02:17 +0530	[thread overview]
Message-ID: <Y6TM4ZidDExh8SPx@qemulion> (raw)

Use the resource_size() function instead of a open coded computation
resource size. It makes the code more readable.

Issue identified using resource_size.cocci coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
---
Note: Proposed change is compile tested only.

 drivers/soc/loongson/loongson2_guts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
index bace4bc8e03b..aba4f8832805 100644
--- a/drivers/soc/loongson/loongson2_guts.c
+++ b/drivers/soc/loongson/loongson2_guts.c
@@ -107,7 +107,7 @@ static int loongson2_guts_probe(struct platform_device *pdev)
 	guts->little_endian = of_property_read_bool(np, "little-endian");

 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	guts->regs = ioremap(res->start, res->end - res->start + 1);
+	guts->regs = ioremap(res->start, resource_size(res));
 	if (IS_ERR(guts->regs))
 		return PTR_ERR(guts->regs);

--
2.34.1




             reply	other threads:[~2022-12-22 21:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-22 21:32 Deepak R Varma [this message]
2023-01-07 20:10 ` [PATCH] soc: loongson: use resource_size() helper function Deepak R Varma
     [not found]   ` <CAAhV-H6cYv=PC76Rsimncoy2udZ4erTzRyy6cMK7zcmeJqO1Ng@mail.gmail.com>
2023-03-01 19:38     ` Deepak R Varma

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=Y6TM4ZidDExh8SPx@qemulion \
    --to=drv@mailo.com \
    --cc=kumarpraveen@linux.microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=ssengar@microsoft.com \
    --cc=zhuyinbo@loongson.cn \
    /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