Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1270907yba; Wed, 24 Apr 2019 18:51:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWRIt5TJh5Wyzl6cm+RXFfSog1WQTCIkp0idInM/PUB/KaAucvKo7uWCCxDILZaOUg3i0b X-Received: by 2002:a63:4c1a:: with SMTP id z26mr17115028pga.324.1556157069853; Wed, 24 Apr 2019 18:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556157069; cv=none; d=google.com; s=arc-20160816; b=rwnte6mMYGX1T/ZiBJoMjME/8ZrB1P24So9lSoy+dEs00ZnsYW1pyPVhL+BP8F3COe l39Cqh0qpOueBGMDEHvhy7J5o1EqE/rmxmhkyydacW2HCniPjjuH7xmAcM3PI7ioaNup KKkbxyQPhLSfBD9k4pe3ScHIUXZixqSvxVtiDpp37DacMIShJ+alb5M7zs6QHylVMpHU 4q9vWVqPrtilfyK/joGD2BHgLl/XBlMPv9ovVcsau8o+bTRZfJOpKqbaItWmVr6ukVaW VAs8IUrp0SwEpqNA4RXzZFYe+ptwLd7Jht67/FwfLgwv2fQz5dmZX7uiir2uS3FGDm4t gHYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0I33DDb3uC3+l/YlJjbOS5rsrNqsJgqWp+yHSEg8RJI=; b=V2/+PIRccb+lF67HkmOrr0ekInbv3PwbmF30pI4xJzmuz/7OsYEdV9rcPfJl8he/l9 lmvMFVIs/yh7EuFuc6DhkgmBqVk6ovmhl2kmwAUgCve4RYcqBbBT2T/YpKS8q3Mrgk0x fwfmhZ9KshQ2fm+Ab81vuzUveUWAHpMt0fSBZFxviFlZIBNOPNjL3K3oqErF+wB01iL2 GIzxh4+qoGtA2H9ERLuOzZu0lflPb0zHP2W2plDHBIyJ/EiwPzHR6h6f/QrsoeNyXLxd ZAhRCYrHoBngGE0aiLx7XZzcFqfc+HZkiNIp47QyQ9M9qv7vC3jCHsp3LGDzbiTxwdvz h17Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QaPitztH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si11807321pgp.481.2019.04.24.18.50.53; Wed, 24 Apr 2019 18:51:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QaPitztH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392359AbfDXRiI (ORCPT + 99 others); Wed, 24 Apr 2019 13:38:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:37276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392345AbfDXRiH (ORCPT ); Wed, 24 Apr 2019 13:38:07 -0400 Received: from localhost (62-193-50-229.as16211.net [62.193.50.229]) (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 9B38321903; Wed, 24 Apr 2019 17:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556127487; bh=m8a22znsMr2CzsgnMSXMk3mQECatXNqkPecNp57vSzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QaPitztHx4bBOEsHBQUUnmZ3fnqJ8AJXV7NamwDWG5cPDMK2MF6E0NGa8lEncoOkZ vccj0K5T3KOUZop4KchwVKCmsgV326Oj86GZYQCuHzHUFmpBMad37k+FWvNgWL91v0 u/xx5HOS6yxyL0Ge0nr/T/+K4adJ2PKZrJ5ocfx4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Ulrich Hecht , Wolfram Sang , Dirk Behme , Simon Horman Subject: [PATCH 5.0 073/115] serial: sh-sci: Fix HSCIF RX sampling point adjustment Date: Wed, 24 Apr 2019 19:10:09 +0200 Message-Id: <20190424170929.312396893@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190424170924.797924502@linuxfoundation.org> References: <20190424170924.797924502@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven commit 6b87784b53592a90d21576be8eff688b56d93cce upstream. The calculation of the sampling point has min() and max() exchanged. Fix this by using the clamp() helper instead. Fixes: 63ba1e00f178a448 ("serial: sh-sci: Support for HSCIF RX sampling point adjustment") Signed-off-by: Geert Uytterhoeven Reviewed-by: Ulrich Hecht Reviewed-by: Wolfram Sang Acked-by: Dirk Behme Cc: stable Reviewed-by: Simon Horman Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -2504,7 +2504,7 @@ done: * last stop bit; we can increase the error * margin by shifting the sampling point. */ - int shift = min(-8, max(7, deviation / 2)); + int shift = clamp(deviation / 2, -8, 7); hssrr |= (shift << HSCIF_SRHP_SHIFT) & HSCIF_SRHP_MASK;