Received: by 10.192.165.148 with SMTP id m20csp4849898imm; Tue, 24 Apr 2018 09:20:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/5KdEfbtK+5Mq1lnpdvEnkAimzKB6SU44GZWNPcKC/rtbvurUG690xJwnfV3ZTo16341NA X-Received: by 2002:a17:902:a717:: with SMTP id w23-v6mr25227999plq.342.1524586835041; Tue, 24 Apr 2018 09:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524586835; cv=none; d=google.com; s=arc-20160816; b=YveX2/rHIpxEdY7ga0Bj6QeDC+wEgjqmmKNcKYmPGpkNC+nDdSshQg4Xby6l7WCEZ/ m5qdxUfcIWFKVhae/4pDVIySQHwzhcQfr87cDzq2ariUhtGpwV5P0SntGRh6jsXdD8T4 wfM5McZvtRKrRKZST+dhCW3VF/LUVdF3OZdys+bsiliT3+x9sWbtV3kTRwfrzU0CveGD Mgh5cYbD3gZ4fQ3zGKWtmdCR/6RpPCOnJoz9a2KEd4G4zWVXg8hdO6e41JvOxKK4iwpt 8ibRINCwr3vaScuSHkCD8rId7q5LsA3HegZVslOAPlqpi4ccEX418bby8YpEiTwAY7rY bX1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=hV4AEbqQBLmBCqgLdp+4jOTzIbIpLF3+PttCQsII8oo=; b=chwNXkUYiPeZYuQ9ovvFA5vuPrlXVwWBLZaAuqFgvg2DVs2U9P+Zlngzd3OiTjcdTx Hf3PQIVOxYE4RkkQ8exYhr1HfAg+1blFsauBmZAkYxN0MoEIN/PPeDWecuPlE/s2YuhN 1+YqflpXWGchOSGeZ00hut1BftwnCtHb3D74DBTrMrY8ye8ql5H1VrAoeVz+mmDaliY2 /bpLZFZ4uEvsk932Hu7yueVH2eZ9ghfkeNiiOSFevcP9kZyMPD8WNsjYTUYwbXJlEwK3 MO0fSBsFRGXLcZhdWGkrpLpzg569MuY3F+SVs2aCUbwgBEwJSJXR3w6TWGxgiumO7UCT 0mWQ== ARC-Authentication-Results: i=1; mx.google.com; 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 n128si11647615pgn.15.2018.04.24.09.20.20; Tue, 24 Apr 2018 09:20:34 -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; 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 S1752158AbeDXQTO (ORCPT + 99 others); Tue, 24 Apr 2018 12:19:14 -0400 Received: from smtpgwcipde.automotive.elektrobit.com ([213.95.163.141]:56296 "EHLO smtpgwcipde.elektrobit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751389AbeDXQTL (ORCPT ); Tue, 24 Apr 2018 12:19:11 -0400 X-Greylist: delayed 905 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Apr 2018 12:19:10 EDT Received: from denue6es002.localdomain (denue6es002.automotive.elektrobit.com [213.95.163.135]) by smtpgwcipde.elektrobit.com with ESMTP id w3OG3lj3018098-w3OG3lj5018098 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 24 Apr 2018 18:03:48 +0200 Received: from denue6es002.securemail.local (localhost [127.0.0.1]) by denue6es002.localdomain (Postfix) with SMTP id E87D819281; Tue, 24 Apr 2018 18:03:47 +0200 (CEST) Received: from denue6es008.ebgroup.elektrobit.com (denue6es008.ebgroup.elektrobit.com [10.5.139.25]) by denue6es002.localdomain (Postfix) with ESMTPS; Tue, 24 Apr 2018 18:03:47 +0200 (CEST) Received: from localhost (10.0.24.181) by denue6es008.ebgroup.elektrobit.com (10.5.139.25) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 24 Apr 2018 18:03:47 +0200 Date: Tue, 24 Apr 2018 18:03:47 +0200 From: Stefan Potyra To: Greg Kroah-Hartman CC: Jiri Slaby , , , , Subject: [PATCH v2] sc16is7xx: Check for an error when the clock is enabled. Message-ID: <20180424160346.GB16979@er01809n.ebgroup.elektrobit.com> References: <20180419130228.rdee6hwsjcui5py7@agrajag.zerfleddert.de> <20180423075519.GA13262@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20180423075519.GA13262@kroah.com> User-Agent: Mutt/1.9.5 (2018-04-13) X-Originating-IP: [10.0.24.181] X-ClientProxiedBy: denue6es008.ebgroup.elektrobit.com (10.5.139.25) To denue6es008.ebgroup.elektrobit.com (10.5.139.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the clock is enabled, check if there is an error. Otherwise clk_get_rate() can be called without enabled clock. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 0814e8d5da2b ("sc16is7xx: enable the clock") Signed-off-by: Stefan Potyra --- drivers/tty/serial/sc16is7xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 65792a3539d0..243c96025053 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1168,7 +1168,10 @@ static int sc16is7xx_probe(struct device *dev, else return PTR_ERR(s->clk); } else { - clk_prepare_enable(s->clk); + ret = clk_prepare_enable(s->clk); + if (ret) + return ret; + freq = clk_get_rate(s->clk); } -- 2.17.0