Message ID | 20230529080251.3614380-1-carlos.song@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1357081vqr; Mon, 29 May 2023 01:22:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6NJxnxcJyXGlF/23Go0SVzlHY9nF4bUiEOhfBtAF50qjys64H2gGXoTEwivL+xFXY/pk0/ X-Received: by 2002:a17:90a:bc94:b0:256:5637:2b30 with SMTP id x20-20020a17090abc9400b0025656372b30mr5005416pjr.40.1685348530332; Mon, 29 May 2023 01:22:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685348530; cv=pass; d=google.com; s=arc-20160816; b=IQg0YMQC5wKz5OFFnh49+nnVONtA/YR2XO/B513jvmghuWqVICP83a8rjJglLdWrDb EDADGT4eMM1yPyDRBh3rMwBtbq4Toy2AixTrOdynk808feOaUYCC/koFXOoHNH6aCP4+ 3X+t/r7rGNToHzSSIFhkmJeNW3dQfaoYZSjdTUMnsCzA54BQ0cSLywITXi5EAwAovnnb qAi3OItrT1yTunP32O/Y3d+1OtIJ/GmFSwssjkmTHwja1eYMS5aIVeEbqrzyqIPADgJl orUXCqEf+GvOiA0DL5OF2IsMDDJOXCCuBiC1RDR3tiY45s0MMh3sbNFRlF9ypus6/cvx gw0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=o7dZR9hkSDnJvP7ioS3I6wEg2oXWrF5cCdXRjyNyx8o=; b=eMEjH231nGXouw9tfbbHtXQGxK/GAdi/PcVdO76wB466zut+NllGm8bLb1tl6fs3VU Grq+WdRa86N7bO3voNnRrHLHiz/asdazV2BEKRTg16pPbz+cCIyZ6b7yqJZ50GdBVCHf uxzj3XKc+n48BsbgFD8ivF0/ABAtNYXDjMcontKUgbmJEfnTsiodggGmvFuVOklVNlga h7r8LdxIFhTmOIINlZGVetnT4Z5yx3H4DqDIGHaW76UY/ic06O8ybt6CHNMql4mmPHIn jIfDQorpGXUYryYhV5Zq2y/m+SYKFy5rdC07hMHSZqRL1a56CUD3uaAJB1R4Ol3nevOu gW2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JTze6pmL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a17090a7d0d00b002473e331f90si9037340pjl.46.2023.05.29.01.21.57; Mon, 29 May 2023 01:22:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=JTze6pmL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjE2IAE (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Mon, 29 May 2023 04:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjE2IAC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 29 May 2023 04:00:02 -0400 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2047.outbound.protection.outlook.com [40.107.14.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EACFDA7; Mon, 29 May 2023 01:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kL3MtjuYALEVYygR96N5/3p88mfSw+vjHGFM4hKRPGR/AoJY0PcvP3QIA0YNXEGbdzLOnIRJiobAldV4Jb86qbJ9D8CxCkjqRu4MfqnBIaBXp/7GyJ7oxvIiW0c9JlLOGcU6lhaUbSn9qTvXHaMr8wzKpQK2EuPQfg/IYzRFxOZXk3f2kGq9+D/C0Tghu2kYNUDV3vSeRG73QrK32eNQuX3Oy2XKwNZC8e6NF5nBK4xpXeo2g2uKsVH8DB5Ag+D4QiyiUaI3WO/XbgRrqEASxa+P8PuSunKRMBLVAjXkGY2TPAe0il2HxzDHZCoGcNo5DnRg6fcbvABRE7LT+MnZSg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o7dZR9hkSDnJvP7ioS3I6wEg2oXWrF5cCdXRjyNyx8o=; b=iC5keAR8tzg4j43FBzdHaVAY2JSmrtDLrNQi0KrAzI1PKw4svZnoFXgZjzCsaZ25ZyPJUG6PUBOWqrG6vURBuXQ4AlZCvzQy4PUbT0pmPam2bYlq58RuHtzowoOfTxDrHwSn29GScEyT+L6McbCv4JVx+styzyjDdPsXYN9jRau0+PZMgz8utZSmkEBS6ntSUq5dhGT0lHbdOM+K72DMyDxBG3byuibtLuXiDdvAxyyn4oYZlL2ZjCP5aJaxWM6vDOk8SIY8I33emMQSrSyiTyEU9XTakHcztAaLm8RzXQhco28FztnvBHxhpGyrtaSqYLPRlfCDuNovSytQm+aZsA== 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=o7dZR9hkSDnJvP7ioS3I6wEg2oXWrF5cCdXRjyNyx8o=; b=JTze6pmLlkgj8AcmrD0GQXCpZQALdNPVTiyP1njPDXB6iCb2Z9G+Pjx4/xlJoGgXrgS/ZAlF47PYZLbd8sWy1+zupQh1t3iE/Qzrcw8EhhgSIynAHxuZr8t/XhcSxvZJSsrk2w/ltTfhJdqdtjAdxKHgZqveDRN8vFgAtgk6D7o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) by AS8PR04MB7765.eurprd04.prod.outlook.com (2603:10a6:20b:2ae::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.22; Mon, 29 May 2023 07:59:58 +0000 Received: from VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::c2d2:71f0:4080:dbb4]) by VI1PR04MB5005.eurprd04.prod.outlook.com ([fe80::c2d2:71f0:4080:dbb4%7]) with mapi id 15.20.6433.022; Mon, 29 May 2023 07:59:58 +0000 From: carlos.song@nxp.com To: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com Cc: carlos.song@nxp.com, xiaoning.wang@nxp.com, haibo.chen@nxp.com, linux-imx@nxp.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle Date: Mon, 29 May 2023 16:02:51 +0800 Message-Id: <20230529080251.3614380-1-carlos.song@nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0029.apcprd02.prod.outlook.com (2603:1096:4:1f4::20) To VI1PR04MB5005.eurprd04.prod.outlook.com (2603:10a6:803:57::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5005:EE_|AS8PR04MB7765:EE_ X-MS-Office365-Filtering-Correlation-Id: a88fa800-cd8a-4a5a-fcf7-08db601ab21f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8wwsBL8TPguA1gy1z069VhKM5SD2pala4ooYnHcFui9ROP++/w7EIJewWpMqKlJ0Kcs66IbAVrcKtNThiZrZB6JJVWTM9e9eX54AvqZNo/0kOk4NtB1W/cyF/qEtclwW0OkpPAmGM5dunv2wSTkYyCidJOC+fOiq2gBr1wxqQY8Jybi6q5HaGRgCuw7Ky+idnIiIN8hRTRk9HkEG4duVPL7tKmon1u9PTO8nBl/6lXNeuk2QB3UVysIcHw6MyXyXEkCVSPwKpoG1ewiLkxogwX8DE9hEDkvlKiZKduv0VBTrZjUZ7+YfCxn8z8ZiqxYN4okqv1ltGPuY0fA0x1jEAxYLtqU46FAtNTrUY83BeER4kdPNmdJzJ/4FV8sZJPzs/KIR2gzgtr2eRSwDmXgHTJtltcYLQAmFmV8cAF8We9VawlqnPXZLN6vbtTrOCd/A1tMfAI45DNnNeQzRF6+xJVlpMPinQje8TT8PDV8jOAMENA2ZxvKn3lcrTMrLG+E8oIfDZJiyf1aCeiEBMtHHO6eJoH4X1fQSzB83cDCpYynzunFAcAACv0umjQoLmNjkznzF7hkTihHvRBvIn5JFSehDUirR/5fdOuk5n8zwdIAMQIotSs6v/QpeENs1jOEp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5005.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(39860400002)(396003)(136003)(376002)(451199021)(38100700002)(41300700001)(38350700002)(6512007)(316002)(6666004)(4326008)(86362001)(52116002)(8676002)(8936002)(6486002)(2906002)(2616005)(66946007)(9686003)(66476007)(66556008)(36756003)(6506007)(1076003)(26005)(83380400001)(478600001)(5660300002)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CNVdcU01lT5P81e9Mc1JPYpPQh5P5JMJiOkzE26Nk0yry1LwYELLn6cyMNoiBCp8w5l2scb0jmX6EI8PzvpC4DDJcC6o9/HDmWa7Ycv2Pyfjw/m9qYs7/0ot5ZxqOv4wTwUBF0WD13i5F/XhnmEuEOPUxeYy7os8xa0QAyLkGJ92POAYT2f3gi2kqO1PXiZBe/WBAU2+cHoEFBDCA3R6xKZdcxZEGk4f6QFaN+ix04kVgTHuF0r5WHBZl4dTMYoWLdtHhOAxKa4i2dcNCt3GGhGLurk2LZ3YJQZ30G25xawfWZlVY/T6kAsLnskee495HK0T2KhO5oLQaXA7IJXvGvYcByp+zlTq/vuxx5xfVOsH5E8k4FY68G6+t2VTlgTuMiOF3S/KgdNdniLk1V/5TQ4MqCz3A+K1oqsGeDLWt0kx6B4dXJFzFfkFB8xo52aiSM99qfNUzvcUed15TcfrepGQqrVPOuVpeEcYMZSCOl7/O/dsQspzfHKD4gyaVDga7aY4zW6sISDONgxxSNlL4PRr3Aa+dRHfPAG7mAOpUZnp1Z89pi0JHSGl3LVYHpWsJ7EKbUVlDq8DQYjCwJhLpctEnfSS5LPm4LTsquLRCv0F+AAAMb72vvWbyXT/504xp37NL1UV785ydWyGmBuXNtgbIToIPdygi8mfMt4UFgcOqgmnn6+S69PRcsTUVzIldT3+0Me4TGAFOm1K12zYjVni34upWl5GxQWgLFVtf7cDW7VdlPVnX2deAXfWI4e+cDvfemjB6DR0sYtrAvueFjlZex2BhNJID41zfy8RqFLhphHBRLHwDLyQ9FHQWSOc7i+sLI243RYbuowAeuZcPMctTeBm+wB626xa62E6qgi8uN2SZX/YK+3N0YefE2+UBpUxCiQpXwdGJKXlOc6x8U6uN6ADHIjHmoFd8UZSiDW9EIQVv+4nMY0EDnIPvzEz5jQfHclhN1ElTiDBLLiG/l+sVjPC5ZbdJhFP7mnxTR/wGzfYwooqo0qu7PcKVAQFChrtwggBphY1aa1mjAybuyYpjOC+1xJ5B/C8b4KXYjE09BpZms2nJw6e2n69+vibgUgzTcJwjiurWI7f/dJxyMSWTE2OBi8cmcubTIh9VgQomzZGKqi1n7jj1/UIJX/NXNhT7ENU6BxdahJohZPF18h73PMutjdSjwdOyXhCF1r64burMKBhXsZ58X340L7D5E0pmYZe1SLGD525tR6NiScXHuTASILkUCvSIsb3U9kKaRbw+72w9JCFA18xBndfXhOtSs5DJDqsYMrCan/kBwBXGB1jsmLDyFutFXbJu1xFdtsyjTyrI8vKR3lw4OvzOIFFl+BZ1gt6zMJtP2W8xyuY0WUdJDm6W++uroDlFThzchp69Zk3gQ/84qZUn+d6dsEEBOLkNAmgn/m2GdHfQUHM8NQs/AfEtxGuR8xczBk1VWSvb5/ggoBMK88d0NmyHfEI2JGoSJyrbNrBCaPY+1lRgaGFIlFXY2Gi2vEThxZA7g7/+Z21HzfCBQQS5lcuMAs/2FZiR7J4pb0EcrrdQo4nKzT34CT0Y/If2Y8AIkm3ZYooapPItOoyTLE3khdJ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a88fa800-cd8a-4a5a-fcf7-08db601ab21f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5005.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2023 07:59:58.0252 (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: fJsr+EQtonhz6zUiPfh9Bq4jI8uJ8XQn3hgOaplo5Goh2bGdxzyyLNWtpDhRw9mjfFSg94KtWLYRc50gZUlfcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7765 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767216020745997950?= X-GMAIL-MSGID: =?utf-8?q?1767216020745997950?= |
Series |
i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle
|
|
Commit Message
Carlos Song
May 29, 2023, 8:02 a.m. UTC
From: Clark Wang <xiaoning.wang@nxp.com> Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> Signed-off-by: Carlos Song <carlos.song@nxp.com> --- drivers/i2c/busses/i2c-imx-lpi2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Mon, May 29, 2023 at 04:02:51PM +0800, carlos.song@nxp.com wrote: > From: Clark Wang <xiaoning.wang@nxp.com> > > Claim clkhi and clklo as integer type to avoid possible calculation > errors caused by data overflow. > > Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") > Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> > Signed-off-by: Carlos Song <carlos.song@nxp.com> > --- > 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 40a4420d4c12..7dd33564cbe1 100644 > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > @@ -211,8 +211,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) > /* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */ > 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; looks OK. Reviewed-by: Andi Shyti <andi.shyti@kernel.org> there is, though, another part I would take care of, this bit: clklo = clk_cycle - clkhi; if (clklo < 64) break; It might be unlikely, but if "clk_cycle > clkhi" then all the calculation. Do you mind adding a check: if (unlikely(clk_cycle > clkhi)) break; Andi > enum lpi2c_imx_pincfg pincfg; > unsigned int temp; > > -- > 2.34.1 >
On Tue, May 30, 2023 at 08:50:36PM +0200, Andi Shyti wrote: > On Mon, May 29, 2023 at 04:02:51PM +0800, carlos.song@nxp.com wrote: > > From: Clark Wang <xiaoning.wang@nxp.com> > > > > Claim clkhi and clklo as integer type to avoid possible calculation > > errors caused by data overflow. > > > > Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") > > Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> > > Signed-off-by: Carlos Song <carlos.song@nxp.com> > > --- > > 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 40a4420d4c12..7dd33564cbe1 100644 > > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c > > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c > > @@ -211,8 +211,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) > > /* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */ > > 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; > > looks OK. > > Reviewed-by: Andi Shyti <andi.shyti@kernel.org> > > there is, though, another part I would take care of, this bit: > > clklo = clk_cycle - clkhi; > if (clklo < 64) > break; > > It might be unlikely, but if "clk_cycle > clkhi" then all the > calculation. Do you mind adding a check: > > if (unlikely(clk_cycle > clkhi)) > break; With clk_cycle being unsigned and clkhi = DIV_ROUND_UP(clk_cycle, 3) this will be true unless clk_cycle 0 or 1, so I'd say this is quite likely to trigger?! I guess you meant something different than you wrote. (And your sentence no verb.) Best regards Uwe
On Mon, May 29, 2023 at 04:02:51PM +0800, carlos.song@nxp.com wrote: > From: Clark Wang <xiaoning.wang@nxp.com> > > Claim clkhi and clklo as integer type to avoid possible calculation > errors caused by data overflow. > > Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver") > Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> > Signed-off-by: Carlos Song <carlos.song@nxp.com> Applied to for-current, thanks!
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 40a4420d4c12..7dd33564cbe1 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -211,8 +211,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) /* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */ 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;