From patchwork Fri Mar 22 15:43:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10866121 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E73C6139A for ; Fri, 22 Mar 2019 15:46:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C698F29183 for ; Fri, 22 Mar 2019 15:46:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B90222A8A6; Fri, 22 Mar 2019 15:46:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 638AE29183 for ; Fri, 22 Mar 2019 15:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727550AbfCVPqE (ORCPT ); Fri, 22 Mar 2019 11:46:04 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:55939 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727244AbfCVPqE (ORCPT ); Fri, 22 Mar 2019 11:46:04 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1M89TB-1h3FUl0ZQx-005ERN; Fri, 22 Mar 2019 16:45:56 +0100 From: Arnd Bergmann To: stable@vger.kernel.org, Ulf Hansson Cc: Chuanxiao Dong , Yuan Juntao , Pawel Wodkowski , Arnd Bergmann , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [BACKPORT 4.4.y 05/25] mmc: debugfs: Add a restriction to mmc debugfs clock setting Date: Fri, 22 Mar 2019 16:43:56 +0100 Message-Id: <20190322154425.3852517-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190322154425.3852517-1-arnd@arndb.de> References: <20190322154425.3852517-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:rNgMA6KuyisLXRfCfenSe1Wq9wIOuO34n904IfRUOVdG701BO8N BsWka5aFdovs3ew+Atu2vZWxg2WBWaFa1PfkL7gqK4/urtKXNZzjMx9p075htozU3cz4MKv FDXFRMP33vZohqA/5KGjaaY7zwUXCbtHbvArBIyuJz8TESWvwKg1hI3Y9EYIK7NlLkcV+kx xRhUoIfRl9jIlvCxXAU8g== X-UI-Out-Filterresults: notjunk:1;V03:K0:zFe/6JXOYhA=:acYPAqDC7pVn98rLvZMSES 4THsCAGfnVUZdV33tqRBRvFIdFNieDIkxhcrQQmTL0gXyMx6EH2BfZgj8Tg2/NqHFf6H3Pza4 MK31PMRC6MqlDc7CUs4xJb/10ChMv7QPJcTUORNK/WBxCTgD/o05lWUCkAbHIZzXBaRlCvkue 43jgkIU2E/aa44EpNzMUNO7FeUzKejJANjDiJYfj8IAR96i0XVy6hsUOVErbkS1cxJvf6c63f 8JIp321mrCl9VEDUC3mCZLKOhlnWnOeIR7Y+6vzwOh4zLVxUaiDnZNN/8MSlo6SUlxbpcPKWF RTLuMKwEWX31ao4qqHM1rbxVTcbUW9Ph9TW5rngLeVnO4netSEkBLP5Wx8Pa2zkeBetw7ItYu N770UisrdkNy06VMvXGwN9ijs/9ZONfFxkgy/MgxdWeKEERG9h436seFiUcBJeh2CxEqtB2pg 1iJ39mxln+0S/JO6NLFc2op1X9h0I0M+20Q+MacNGiErMRDTaEgKCoE1XlyflqJ2VWO/tmPJL jS2h6VyEGIfk9h1wTFrz+4hPpr9hCbK7XAnsr7vBRTTVtGIATQ3QmoJ4I1n6hLH9T0qGO+5Mu K2t50KugpzaJHaXx7bXoZ4RYZEFwKqhNJTpkoMImgnMOvc6jx41jL+lbdzPbSQhQ4ReXioBD6 qs0JyYJzNuTowuraliXuZWmWRYTrk/YJkiFIzH/H1FDkjhDxijpZFpZL5b/y8rclYyNZ7XZ75 EgYpTtfyCOntmVn61fyx4BrT+qMzBbRmE9UUeA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chuanxiao Dong Clock frequency values written to an mmc host should not be less than the minimum clock frequency which the mmc host supports. Signed-off-by: Yuan Juntao Signed-off-by: Pawel Wodkowski Signed-off-by: Ulf Hansson (cherry picked from commit e5905ff1281f0a0f5c9863c430ac1ed5faaf5707) Signed-off-by: Arnd Bergmann --- drivers/mmc/core/debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c index 154aced0b91b..705586dcd9fa 100644 --- a/drivers/mmc/core/debugfs.c +++ b/drivers/mmc/core/debugfs.c @@ -220,7 +220,7 @@ static int mmc_clock_opt_set(void *data, u64 val) struct mmc_host *host = data; /* We need this check due to input value is u64 */ - if (val > host->f_max) + if (val != 0 && (val > host->f_max || val < host->f_min)) return -EINVAL; mmc_claim_host(host);