From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94FAAC43617 for ; Wed, 5 May 2021 17:11:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC848613BF for ; Wed, 5 May 2021 17:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237304AbhEERMr (ORCPT ); Wed, 5 May 2021 13:12:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:33786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237078AbhEERBp (ORCPT ); Wed, 5 May 2021 13:01:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D45CC61613; Wed, 5 May 2021 16:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620232872; bh=6Y5i4m5xCXTHXcjcTm1/tQMuYDcrC7o+ggBgjbU9qFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkYwLMkSrCINW6bmUb3KsmZDr9Ei4FMDkgdgF19292O5lSKthH9ag8tlgECvj4AT/ DVtQ+CpDbgjaRhH4ephUrv3zZE/s+JvtG/AU5OocVEB+NbdfEgauzCoQfhm/AvYrD5 BXSS8qR3Qsdxnxv7InLgV7Gv6dNTd/PI73OhocSYfV+0EwpoMH+Lo0KRYixNW2cIY/ cqfWWsIGZzBP4YLiTpgqqbcm1p3JLiWi/MKJWb1KFqoCugzAHIv24s9XhCUSSnp12S Z+dCCkO4ViZ+L0RsLqsnU5auL30v3seLLhbwd6MiKlJz6c5eNlA5ufoLWgPu8uFqsI lnDMWgKoQNgKQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Krzysztof Kozlowski , Sylwester Nawrocki , Linus Walleij , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 13/25] pinctrl: samsung: use 'int' for register masks in Exynos Date: Wed, 5 May 2021 12:40:39 -0400 Message-Id: <20210505164051.3464020-13-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210505164051.3464020-1-sashal@kernel.org> References: <20210505164051.3464020-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org From: Krzysztof Kozlowski [ Upstream commit fa0c10a5f3a49130dd11281aa27e7e1c8654abc7 ] The Special Function Registers on all Exynos SoC, including ARM64, are 32-bit wide, so entire driver uses matching functions like readl() or writel(). On 64-bit ARM using unsigned long for register masks: 1. makes little sense as immediately after bitwise operation it will be cast to 32-bit value when calling writel(), 2. is actually error-prone because it might promote other operands to 64-bit. Addresses-Coverity: Unintentional integer overflow Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Link: https://lore.kernel.org/r/20210408195029.69974-1-krzysztof.kozlowski@canonical.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/samsung/pinctrl-exynos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 6925a3d969e2..13d6a50ca96c 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -55,7 +55,7 @@ static void exynos_irq_mask(struct irq_data *irqd) struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; - unsigned long mask; + unsigned int mask; unsigned long flags; spin_lock_irqsave(&bank->slock, flags); @@ -83,7 +83,7 @@ static void exynos_irq_unmask(struct irq_data *irqd) struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; - unsigned long mask; + unsigned int mask; unsigned long flags; /* @@ -409,7 +409,7 @@ static void exynos_irq_eint0_15(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static inline void exynos_irq_demux_eint(unsigned long pend, +static inline void exynos_irq_demux_eint(unsigned int pend, struct irq_domain *domain) { unsigned int irq; @@ -426,8 +426,8 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc) { struct irq_chip *chip = irq_desc_get_chip(desc); struct exynos_muxed_weint_data *eintd = irq_desc_get_handler_data(desc); - unsigned long pend; - unsigned long mask; + unsigned int pend; + unsigned int mask; int i; chained_irq_enter(chip, desc); -- 2.30.2 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CB66C43460 for ; Wed, 5 May 2021 17:01:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C795B61155 for ; Wed, 5 May 2021 17:01:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C795B61155 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s3aju7fkjoOEDViylCMNTmuAQ2QUvYiISgDdchmqE7E=; b=T1kxs3IakT3KqNMGGiss9unNu YfLkAOneO5YPPsVemPDGIJYCfrfZ+1KiWYyQWBrRyLwoNrhJ3xOgUf+cGrq8GkbQaITQmkOKqwIT5 GTgyBnSlwpy1bPO4EN0cks8Y5vCYmTcqXxaD7F9JVlj9h4eLHmm+MXrI/rEjpAVOutLazyNoaB2Zq 5Vw8O4HuMSGpQhpAyGOHELGpx8qJA/ol+p9qJQ6/61GX5U59Mpbj4m84mfgTuvyZAzdPNupXyd9X8 eqA4mgYMKM7zXtlXIL+v8MorBQRdNEcjmtEXnkFEQ9Y4ldxhNRa480SEoFy9dK8wVXDKNGTdau9em NzKtTkoZg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leKrh-001oib-09; Wed, 05 May 2021 16:59:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKaL-001i4S-A3 for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 16:41:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=OZ/VoEV/bYK9cog1HpKgU2K1U/bqNbEexAngVmXQPhw=; b=1OS0SD2BBVpPNcARVT3LWXBltn juHin39foKtYMRzlvSLZra+gJd7QLJEJhYmP0abeemW8X4g5trwrr54CUP03H2pkmQEqYg5u6Za3Y PCeEunXt/TQYPiUWY03hn9aMCmDitTMUrPfSBORdWL7NQNrlUz2QW0OcjKTsvRZ6YuEX5uG1dzqr6 NHV6jM8Mk5579qBqWtWxG6hao6nmR0l6kYPVigGh9YuX6tt8LJDXSDrwQ8eTu11aCT2BJox2K/Krf sgGxPl2HCHtra2+DhYIXtnyOpEZpXVhxZchM1a6iDLVTiMkB7lWhGu47aH1OTwvAnCVGQeB1hrAR8 W6mPG+RA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leKaI-004yIL-G1 for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 16:41:16 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id D45CC61613; Wed, 5 May 2021 16:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620232872; bh=6Y5i4m5xCXTHXcjcTm1/tQMuYDcrC7o+ggBgjbU9qFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kkYwLMkSrCINW6bmUb3KsmZDr9Ei4FMDkgdgF19292O5lSKthH9ag8tlgECvj4AT/ DVtQ+CpDbgjaRhH4ephUrv3zZE/s+JvtG/AU5OocVEB+NbdfEgauzCoQfhm/AvYrD5 BXSS8qR3Qsdxnxv7InLgV7Gv6dNTd/PI73OhocSYfV+0EwpoMH+Lo0KRYixNW2cIY/ cqfWWsIGZzBP4YLiTpgqqbcm1p3JLiWi/MKJWb1KFqoCugzAHIv24s9XhCUSSnp12S Z+dCCkO4ViZ+L0RsLqsnU5auL30v3seLLhbwd6MiKlJz6c5eNlA5ufoLWgPu8uFqsI lnDMWgKoQNgKQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Krzysztof Kozlowski , Sylwester Nawrocki , Linus Walleij , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 13/25] pinctrl: samsung: use 'int' for register masks in Exynos Date: Wed, 5 May 2021 12:40:39 -0400 Message-Id: <20210505164051.3464020-13-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210505164051.3464020-1-sashal@kernel.org> References: <20210505164051.3464020-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_094114_625896_78212FC1 X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Krzysztof Kozlowski [ Upstream commit fa0c10a5f3a49130dd11281aa27e7e1c8654abc7 ] The Special Function Registers on all Exynos SoC, including ARM64, are 32-bit wide, so entire driver uses matching functions like readl() or writel(). On 64-bit ARM using unsigned long for register masks: 1. makes little sense as immediately after bitwise operation it will be cast to 32-bit value when calling writel(), 2. is actually error-prone because it might promote other operands to 64-bit. Addresses-Coverity: Unintentional integer overflow Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Link: https://lore.kernel.org/r/20210408195029.69974-1-krzysztof.kozlowski@canonical.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/samsung/pinctrl-exynos.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 6925a3d969e2..13d6a50ca96c 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -55,7 +55,7 @@ static void exynos_irq_mask(struct irq_data *irqd) struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; - unsigned long mask; + unsigned int mask; unsigned long flags; spin_lock_irqsave(&bank->slock, flags); @@ -83,7 +83,7 @@ static void exynos_irq_unmask(struct irq_data *irqd) struct exynos_irq_chip *our_chip = to_exynos_irq_chip(chip); struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); unsigned long reg_mask = our_chip->eint_mask + bank->eint_offset; - unsigned long mask; + unsigned int mask; unsigned long flags; /* @@ -409,7 +409,7 @@ static void exynos_irq_eint0_15(struct irq_desc *desc) chained_irq_exit(chip, desc); } -static inline void exynos_irq_demux_eint(unsigned long pend, +static inline void exynos_irq_demux_eint(unsigned int pend, struct irq_domain *domain) { unsigned int irq; @@ -426,8 +426,8 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc) { struct irq_chip *chip = irq_desc_get_chip(desc); struct exynos_muxed_weint_data *eintd = irq_desc_get_handler_data(desc); - unsigned long pend; - unsigned long mask; + unsigned int pend; + unsigned int mask; int i; chained_irq_enter(chip, desc); -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel