From patchwork Fri Jan 24 09:22:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233312 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 4D670C2D0CE for ; Fri, 24 Jan 2020 09:37:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1331920838 for ; Fri, 24 Jan 2020 09:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579858667; bh=X0f4cxM6Ak9BE9aW1xSwdIbJRjIDPBgKED8Hw+uIT5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vxGVCO8BOJ9BXG/qK0kDqd9FHMa9GMWsmcgqafNH+hObb4oaoM0jwo5bK1mWijeQa NbBTZBSFFBpMEXunITuPOeSgsxK8EvtbcZRh8xn6DEvsML178J/avTlNqkGhiMkfjF F6meovPd+wC1hM2yMM+MQ2FmomOpLFmpVc0yBSIg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729746AbgAXJho (ORCPT ); Fri, 24 Jan 2020 04:37:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:35076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729719AbgAXJhn (ORCPT ); Fri, 24 Jan 2020 04:37:43 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A575120838; Fri, 24 Jan 2020 09:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579858663; bh=X0f4cxM6Ak9BE9aW1xSwdIbJRjIDPBgKED8Hw+uIT5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdOFheO93hnlSfxf2frDzRchIrscjm2w3D2pI2QSfCmiAq7xyGbvc17uw4AH0vUJT y0KZC+VcC5QVk+ttzOAY7TsxzWNt+hbL0EkGyKZ2kiVyuFG0VvE5oz6OklGdEiTuXT NWR+BCIoHtGNwVZDH1g7TrpbzWQBUEhmIg/PTVHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alain Volmat , Pierre-Yves MORDRET , Wolfram Sang Subject: [PATCH 4.19 004/639] i2c: i2c-stm32f7: fix 10-bits check in slave free id search loop Date: Fri, 24 Jan 2020 10:22:54 +0100 Message-Id: <20200124093047.633397596@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alain Volmat commit 7787657d7ee55a9ecf4aea4907b46b87a44eda67 upstream. Fix a typo in the free slave id search loop. Instead of I2C_CLIENT_PEC, it should have been I2C_CLIENT_TEN. The slave id 1 can only handle 7-bit addresses and thus is not eligible in case of 10-bit addresses. As a matter of fact none of the slave id support I2C_CLIENT_PEC, overall check is performed at the beginning of the stm32f7_i2c_reg_slave function. Fixes: 60d609f30de2 ("i2c: i2c-stm32f7: Add slave support") Signed-off-by: Alain Volmat Reviewed-by: Pierre-Yves MORDRET Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-stm32f7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -1253,7 +1253,7 @@ static int stm32f7_i2c_get_free_slave_id * slave[1] supports 7-bit slave address only */ for (i = STM32F7_I2C_MAX_SLAVE - 1; i >= 0; i--) { - if (i == 1 && (slave->flags & I2C_CLIENT_PEC)) + if (i == 1 && (slave->flags & I2C_CLIENT_TEN)) continue; if (!i2c_dev->slave[i]) { *id = i;