Received: by 10.223.176.5 with SMTP id f5csp1200618wra; Fri, 9 Feb 2018 14:33:09 -0800 (PST) X-Google-Smtp-Source: AH8x225bwkSECVouqbVEOvLoywKDvrP2pT5jYbrpkltdEcYOa9hcDb6wO1cIw+mjEZC3DpXpgNvG X-Received: by 2002:a17:902:6716:: with SMTP id f22-v6mr3971141plk.180.1518215589286; Fri, 09 Feb 2018 14:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518215589; cv=none; d=google.com; s=arc-20160816; b=sC6CVqE6ntImtBltS1nIGt0pYw4cMKMqtXBUQwtUl5grPNH6p991d9Q7WxHZrxBLVx d7FJUW2ocnz/JhcuiBeX87Z7kV+QIqi39WxHtefcbK/nXyMVdnPv4K6oihCgIiLC6V93 ia7RloQDN1cMDdj3lNr5z07+ZZuOpULfBCKZ0nw8zE3o4ZLarbCVk98rdL0NNS6oRGE5 89Uh/F0zVe+KyHCrz+gqIPb9TxEibgHjzmOwnBfXygjgek/UjA8ZgeZOtuxHo3d/oFeY rfYhZblCKZfDSS/kvKhXXrKE4SzakcjV0LuEVUNXizC7cl8J4Uu1Yace0XgvS/s4jehD LYcw== 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:dkim-signature:arc-authentication-results; bh=60JPocEwRbcLcQmUwEsu+f/Kv1p9TwblYItR6Tz92fU=; b=eGIqA3LJOleSlZXqXCPVaVrRWmywdMWRpwW9MPDPK2eBwRxzJ02be4Om6s1HYYIJsI aNRZ4VopJsuObTKegV8kFFgDalJe2vWxxBYeJFg8MCUcSowYHbBvrSeVIR7TAZfg0U1b 2NdvtXyukT2RwdRXQ5Cw+z9/OMvvB3bitowaL2Vett82suMCrDWTvYm/U3iu8cYGnbPI o+01sGU5Td/qvSn9nnBUeapiRaMevj9VPSuZWJmOpm/Ep7dSdNAZQws8xX8oLtvFHH5C iI9bgqWZ7uc2JfqFe39v9FCUVpPwcRTVp4DQFIZJt2XaIp+f6Li2gzUhddskrCX6JBaW I5ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=IlBifF8w; 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 j7-v6si247498plk.553.2018.02.09.14.32.55; Fri, 09 Feb 2018 14:33:09 -0800 (PST) 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=fail header.i=@gmail.com header.s=20161025 header.b=IlBifF8w; 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 S1753006AbeBIWcN (ORCPT + 99 others); Fri, 9 Feb 2018 17:32:13 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39318 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbeBIWcL (ORCPT ); Fri, 9 Feb 2018 17:32:11 -0500 Received: by mail-pl0-f67.google.com with SMTP id o13so2101115pli.6; Fri, 09 Feb 2018 14:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=60JPocEwRbcLcQmUwEsu+f/Kv1p9TwblYItR6Tz92fU=; b=IlBifF8wEnWbfJ5R33mLTlc3JVJ2gb/tCssDOdgQZomflpNuycW5pXGMqVvTKMudit RCXCxuye6gzK/5jk0gssTz29l8rR9aZrRTISBoKDh5GKPkMuswZyFdN+kW6VO7UcUtBG t5S3RVghrYFRMWZ0hrsNL5ai3L36K4aNePjrKpnEhA1KyAcVd09Mjywm2C7Wf5Y6kL2W pXK14v5AbTm2SVyi7UF+RwvhdvpBkee1yTZgmnhPZ5UT0IwgGWoIYDHDa4x2a5sJyEkB ZmJlGaoeggEA/my/2bndObC+6kY827NUw1YxTmmrv/0/RmRZKgzoP0LFN18e2WvhCdp8 OWBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=60JPocEwRbcLcQmUwEsu+f/Kv1p9TwblYItR6Tz92fU=; b=sbJDLFuWZRtf1h6HmnQEZih5ri+0gkkUFH2BJOc37rQTR1A0X8cYGDeA/l1ttz/XVQ 8JsYT8yiE2SLINiFE/3i2wkHU6LSsCRz0YdTITv+Bi50jDR0GtgzyBB1fnakhPEhxuK8 I5+6egA8JllAiBqJOHgg739WEU0l1gwTj3alxFEywiQiNaksvywCYoKoT2yY5bZCPF+o m7QbPQoRO1scepF8emcUgFYlSGzZbDqW1tLQvM/cw0l2qwmWRJiuimW4jeU2wDvz96rQ w0xz+gztc3ftEjWVnNMDnqqQDwzXMMarsdzxnGqIANDIqf7KWVSqB55ORtkwypsXuwro H2kA== X-Gm-Message-State: APf1xPB9Yf75iTBQ2/ukYzV3S+134MvjR+pxoj+kpAv5HL0K6SjLY6jR XMiEFKQ+yG8C5GWd8AvJhyyxzw== X-Received: by 2002:a17:902:6b48:: with SMTP id g8-v6mr3903371plt.151.1518215531383; Fri, 09 Feb 2018 14:32:11 -0800 (PST) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id 3sm7823104pfo.117.2018.02.09.14.32.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 14:32:10 -0800 (PST) Date: Fri, 9 Feb 2018 14:32:09 -0800 From: Guenter Roeck To: Alexey Khoroshilov Cc: Wim Van Sebroeck , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe() Message-ID: <20180209223209.GA19627@roeck-us.net> References: <1518213389-19246-1-git-send-email-khoroshilov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518213389-19246-1-git-send-email-khoroshilov@ispras.ru> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 10, 2018 at 12:56:29AM +0300, Alexey Khoroshilov wrote: > If devm_reset_control_get_exclusive() fails, asm9260_wdt_probe() > returns immediately. But clks has been already enabled at that point, > so it is required to disable them. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov > --- > drivers/watchdog/asm9260_wdt.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c > index 7dd0da644a7f..de9e538a5fa8 100644 > --- a/drivers/watchdog/asm9260_wdt.c > +++ b/drivers/watchdog/asm9260_wdt.c > @@ -297,8 +297,10 @@ static int asm9260_wdt_probe(struct platform_device *pdev) > return ret; > > priv->rst = devm_reset_control_get_exclusive(&pdev->dev, "wdt_rst"); > - if (IS_ERR(priv->rst)) > - return PTR_ERR(priv->rst); > + if (IS_ERR(priv->rst)) { > + ret = PTR_ERR(priv->rst); > + goto clk_off; > + } Good catch. I would prefer to move the code around, ie call devm_reset_control_get_exclusive() first and get the clocks later. Thanks, Guenter > > wdd = &priv->wdd; > wdd->info = &asm9260_wdt_ident; > -- > 2.7.4 >