From patchwork Wed Mar 17 06:53:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 12144981 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.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,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 E60E9C433DB for ; Wed, 17 Mar 2021 06:59:00 +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 77E1864F01 for ; Wed, 17 Mar 2021 06:58:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77E1864F01 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com 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=wOVd5jq63EoW6uIxByCo15KhtJcdlpjgSHbXuVzEg2s=; b=KWzAZ5AYeDKWXYqL2WIY3XVw9 bkcJ6hhM0qSPBaHYVsSGNalU9rncqBRN/N1DTxAj405wm1gUqlij7wViup9tlVZwakqUZswYI8SGv K2EL6mwUtEs9WvhGWxuU1WJms/SkONLRZBkzOln/59YZtVI3CE5h3jKgO96nl07yt1BPEIAwA0qL5 ub7u0vzJbG31XeugIdqkFckH/8kbkKIhl1GatK4mv00Tqv1rUpDazVwfAfq2IO/I1HA9J66leJYeP fWT4rRDQytN8+J492JXqEpcnhfS/0hPJEHdcGjAu0GzusSgO35L+8kk7WELY+8xzA5NNLLn3wExP0 0o9mpglWA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ7I-002cLK-Um; Wed, 17 Mar 2021 06:57:17 +0000 Received: from mail-vi1eur05on2063.outbound.protection.outlook.com ([40.107.21.63] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ4Z-002bHt-KG for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 06:54:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hLD72RxoK4tXryKMHmk6gt6Ji3hsuRhoQ9uEHVsQVgguwUZWHo9gHC2gBxhv9Vj0eVDa58CLuDNUqwkoDxjnO6+xBEtfzmybzRlge46i3IfTyp8d5R5LQMs1j+ooo3MwewY2wD0377kc3vfPdm3FFRPrho649z3YO3bDd5g1IgVCGFIUNfEXhSO5HyDHTh8QFXIQZ+wTyPci1lfdZB3FBd3k1h38viXCT/5dnG+Hw64C1yxupHdT1CNzVqzMvLcFWhFpbfT33p9hJ0q8+UKGCg14HBpesOWuCT2pbyZQ2te2KmPQsrO43eegthhwUEbyNKMiO4pRtqdFlEswhFaPcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BagA/Axfg8Zv4aALC4CkXudKzO2dNPuET78QEzdF6Ho=; b=WvcEsM0C1xorAgMRT1apKKqjGnlnUEpbTq8CqpRz970lXmanwS4+dDTTZyuS7BOyx+zT0T58gCqBBM5ctQB3lK7XjT/c0cLFBSQr2ganNpWmIui0X8YC8IIaGerH+pPLuU/5XfihQgxKMTlMQ3bDjwjZBUjsZSYixNoVIz81ghXIXtzUZWJi8idBGxALwuDNZotMmYYC9/4S9zQk6xUc8ET8O+E+HzDBYXqiCiz1zmAllganV6fV4BmdXuNhBE/4xkHkvhtxQRM++vVS3icB2hwVPalFjv3Q/IYxrQ7nNpQ0IwNTl1cL3xukpOxmAGCh+molA0btEIGWCLXyPaw6GQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BagA/Axfg8Zv4aALC4CkXudKzO2dNPuET78QEzdF6Ho=; b=ELUQf81zZvfuP/deXF8udVPMlBo17mkQbg8op5KUxl6J/5xF1oRrqpxRPxMkSpXd2hXbROI3QWeAPrgRkGF8dL4WzO8E5lvl5n2CMisuXqm2CyE7VL1yWP6aDemaYbpSH97VDgJSSoRVVQplx6vUabj19p74uIyheAKZs2bDCIY= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) by AM0PR04MB4196.eurprd04.prod.outlook.com (2603:10a6:208:56::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 06:54:24 +0000 Received: from AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236]) by AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236%7]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 06:54:24 +0000 From: Clark Wang To: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/11] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle Date: Wed, 17 Mar 2021 14:53:58 +0800 Message-Id: <20210317065359.3109394-11-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317065359.3109394-1-xiaoning.wang@nxp.com> References: <20210317065359.3109394-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) To AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 06:54:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e668afdf-2df3-4371-9b24-08d8e911800e X-MS-TrafficTypeDiagnostic: AM0PR04MB4196: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:331; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NRev2lVsWHr1HrhbLXLdpJWFu3fSOKjyxBfZnkir2RtH7ZsRoF3DibxOOyr0z12JP5ACI+F4E7TYuZa62CkudjfWKnH5inOn2EPuPyISRGD1YHl90ZYxbS+nGZDU7RiEvWijIkY9PrZBuayDa5rrNBhDATZW34MUEYmhlKfL620JPI06HAI4PNk+DCWl11mp6V5YnbLtOHZRImgU+Fvbw+xjseQmWtRCgiZOu7REL0ffJ9R/ieFvSn51/9mJm1huEaMCsPFdPOMwmn6L8pNnmIkeAa2A8irWlXY+i71peFcEHZH9+jAvWKAJMALVru4u6sBSqEkhkY5dod1AFKdz7JYWbIxXh5RKd3NQbKAmxvqHUgEL9sTFo1619hM/i7G/QOrySTwnjI+JUeZ6f2OMRwc0V7ZkGLqCcLjCltri7UZw+IzSMSjs0H8ct0fmGY6CTsbDY8RVFE2Pa7tp0+39lsOJPkR7F2slarTiZwJsFbDKlc3DpE8MWUD1e+e+huaZb8yodAvbnq7F6NSKh/yq7fp/wSWDTeEAqQfZ/tcAE5DXFneKfH8PXb+CijA0Hzzq/BeJb2E18CAXdFrvYNoJHYLpAOxF4xZduXEGNOHvJhNMEj3Mv/jf6AIB2GXgZ2ae X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5618.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(66946007)(6512007)(69590400012)(52116002)(26005)(6506007)(2906002)(36756003)(2616005)(8936002)(956004)(86362001)(4326008)(5660300002)(8676002)(66476007)(66556008)(478600001)(1076003)(6486002)(83380400001)(6666004)(316002)(16526019)(186003)(4744005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +MJpi/7tp5sUcZ86NHY+BvEe+Pq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oEv0fFmsCelSw0WNkPKwOdeWr5wVs4COcXkBOzgeVSyC/8WD7DqUj3zziUBeYrYTmNWjm47km/PYIog9DPL7svtC42KZx7+YdzAfi7noO8EFoG7nvgyXbMTRDGErCGmTtEqpLCM9sUap2QlxWbLuo8kJUxrz1Im5393L4eSzWeaxlrwwQ0jzOL82pHhNyVuMAyiNWxllXiplc3x7z+Je1YabOACKmvNnTbIXdsm0LfhT1fWuiwUFYPwALJp X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e668afdf-2df3-4371-9b24-08d8e911800e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5618.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 06:54:24.8200 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UGJf1H4JNg/EbA4wZPqhAd/bVWNee2oLoenTFnjZcMQRLKeHCzbk/W54gOMYze5RqzYPHOsxWhDDSMudYszlxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4196 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_065428_062704_C5D45C70 X-CRM114-Status: GOOD ( 13.03 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Reviewed-by: Fugang Duan Signed-off-by: Clark Wang Reviewed-by: Dong Aisheng --- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 5dbe85126f24..1e26672d47bf 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -213,8 +213,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) CLKHI = I2C_CLK_RATIO * clk_cycle */ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) { - u8 prescale, filt, sethold, clkhi, clklo, datavd; - unsigned int clk_rate, clk_cycle; + u8 prescale, filt, sethold, datavd; + unsigned int clk_rate, clk_cycle, clkhi, clklo; enum lpi2c_imx_pincfg pincfg; unsigned int temp;