From nobody Wed Sep 17 03:31:47 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECC7FC4332F for ; Thu, 22 Dec 2022 21:32:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235345AbiLVVcx (ORCPT ); Thu, 22 Dec 2022 16:32:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiLVVcu (ORCPT ); Thu, 22 Dec 2022 16:32:50 -0500 Received: from msg-4.mailo.com (msg-4.mailo.com [213.182.54.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54D6C220D5 for ; Thu, 22 Dec 2022 13:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1671744745; bh=m5A13CbMy20Q47cLnzC6Fb6fhQStUuVBXbSnoheidMw=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=jo2h4mRhgABlqJVSOkh+AOYw9YgnQ62n/FQwXqdp57JOm0M48hS8t6NQlWTPPUfm0 SOJLBfq3qg0V28fYH2R+SKutRUdw1NgJSJ4NYRZ7OiePtV2Z4qgryFuk6U4kmed1js k6RF3Y/ONgGqU5KIliHlJEmgC4JWsYl+U4UCTY+k= Received: by b-3.in.mailobj.net [192.168.90.13] with ESMTP via ip-206.mailobj.net [213.182.55.206] Thu, 22 Dec 2022 22:32:25 +0100 (CET) X-EA-Auth: tNs3jUzJmrB1wishT6YQd/hDpbc92I55S2KpqxvBARFKBIIUugaz6hFy61mU3PncJY/3szve5aMOVJKIR1WPju0/Ks6Qpq+y Date: Fri, 23 Dec 2022 03:02:17 +0530 From: Deepak R Varma To: Yinbo Zhu , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Saurabh Singh Sengar , Praveen Kumar , drv@mailo.com Subject: [PATCH] soc: loongson: use resource_size() helper function Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/l= oongson2_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 =3D of_property_read_bool(np, "little-endian"); res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - guts->regs =3D ioremap(res->start, res->end - res->start + 1); + guts->regs =3D ioremap(res->start, resource_size(res)); if (IS_ERR(guts->regs)) return PTR_ERR(guts->regs); -- 2.34.1