Received: by 10.223.185.116 with SMTP id b49csp1341906wrg; Sun, 11 Feb 2018 09:47:32 -0800 (PST) X-Google-Smtp-Source: AH8x226yhqdZn/URMo6XApk/xw7JPtcAbXFwh+wz0Nk/4lTlEygC9ejWCdSPJSs/nroS/n3DOHwv X-Received: by 10.101.101.149 with SMTP id u21mr7691924pgv.251.1518371252154; Sun, 11 Feb 2018 09:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518371252; cv=none; d=google.com; s=arc-20160816; b=iCP1EXeDAQgjKjgEKxj9y7ur47XwdUXB1XfLeC9RmnlXbwk21r//SCbebk/bDnwCa8 OjlTV4v8OMmZAXOjnIIFtVb8wbA2uLl57ypMHVE08ewGG4VYMv09mDZaGFWPxXxiqPxR bQ4TGEdUUvmW4x5Bc7JCzZoTfpCExrzlJh2w0OjED+Iy0Y9ZwARz/G0zs2rpuogVenUo tyodXZ4dhpuKziMjuea+bVo/AIDcQkiky4ocNpofGY59jGL+KrIVZBe0GPL03KNJ9gT8 o2OI48AFho6YhkTel4GEghnmNDeG4qVEsFO+wTj2mj8PoWqe89OCCr8BaN9EQngd7gOm nTRg== 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=SmdTOwBj19YiwX0bSLYFVYkeh+CK7IKZWeAZqK98Ljs=; b=032DZvyXHBWnv8vUpYdSppDewuT5ZvHILQDHDWRv7hFhwDwmOWhtkulqGz9LdXtizK REy/mxZKcHRVa3oOL+BdAyZ5Sn4rvfmjd5U96kgaNeIhRAMLX0YoaX9wkvIaFtUoGu95 hJ9ndj/CqxBzUjFx32YeZmEZWUPs0ykISLgWeTEFdTpvxzsqGApyXMQN0rozGzB+UawG xDKm5XaPImjJn3t4qvEB8SFJmv5CRy+G6mmJP3LAt6oesuXGsquywHrGWvNiUL03djk2 P3N1r36DWPBV2/HskId1qm+Rnw3U97fwgFo8Q7ajOiTCL7bLoIU5BjUjUW4tuMP7gQQE x5RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=FgzqJo1P; 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 p14-v6si1956133plr.282.2018.02.11.09.47.17; Sun, 11 Feb 2018 09:47:32 -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=FgzqJo1P; 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 S1753567AbeBKRqk (ORCPT + 99 others); Sun, 11 Feb 2018 12:46:40 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44335 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbeBKRqj (ORCPT ); Sun, 11 Feb 2018 12:46:39 -0500 Received: by mail-pf0-f193.google.com with SMTP id 17so3233616pfw.11; Sun, 11 Feb 2018 09:46:38 -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=SmdTOwBj19YiwX0bSLYFVYkeh+CK7IKZWeAZqK98Ljs=; b=FgzqJo1PZh6KzuZ/zcRPlH65P9bip2e25DoP9IiDQBy42AdT61dhThVJabrARYQvXY Tt3A3ddU6CEowcjbPEm/xicwwR2gth1DMQX7P3coI4Cqh9DRcGyxufiBYJEjLlrYMOnc eL9PSnfz1SuU0y7MLNaLmQnsGlVactUak5y0tNXagJI6l3Y/CYR2kgnktJUFf2huXDxb 6NQAycjLbYUOOVi6RC+MTWgXJEX1Bb6IeQMmYMAKZ/w8L6ujiPiPkE5MRJWMnvRYBDg5 kD3HfdCHwqqAGbp45Gdsm6Kd/dh4EwLS/oBiiYdFt0u10aBvXG0uj5cjmW3eBrF3uJCe CWaw== 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=SmdTOwBj19YiwX0bSLYFVYkeh+CK7IKZWeAZqK98Ljs=; b=SKj9UEG9MFwv2V1nzyFPeHpV7+Pk0QRMUmL40J2B/+HXfPWT2u9dqWsVp21wffc/Pd c1Z6mq1kC3UgBmvESZleEYuQ3i9stszjwOI+FFVTUrvEsDwrZ6d/WIl+dDHAB8QSfVCb 4uvRoDtMMwWdmEGoUvPJoNa312cf4ZAVxORGtWMIdEUh0jv0kGYaAofn4TtdAIsneKG9 AEEwA+pnrYDhpleXRIa4R8EMEqyF5jAWJWYWI7YkrJBjpaTy81ICmTQARLtHJRHNntcW u/lvMKJBibQGwxJnG+22uUVZNye1STDloZnxV6rcNfXuTBGKDM0LVXhjMFm5QMNTk4hw PKbw== X-Gm-Message-State: APf1xPAq/AeQ05JOSXDZ/O4oAragifVFn+fxl4NDBwQ3FZ9W8sCNc5Ci pet/cBstSn3GZjbUmovK2WSoyQ== X-Received: by 10.101.80.69 with SMTP id k5mr7625060pgo.447.1518371198590; Sun, 11 Feb 2018 09:46:38 -0800 (PST) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id e189sm19686593pfa.4.2018.02.11.09.46.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 09:46:38 -0800 (PST) Date: Sun, 11 Feb 2018 09:46:37 -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: [v2] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe() Message-ID: <20180211174637.GA19546@roeck-us.net> References: <1518257847-28796-1-git-send-email-khoroshilov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518257847-28796-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 01:17:27PM +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 or to move the code around. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov Reviewed-by: Guenter Roeck > --- > v2: Move the code around instead of disabling clks as Guenter Roeck suggested. > > drivers/watchdog/asm9260_wdt.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c > index 7dd0da644a7f..2cf56b459d84 100644 > --- a/drivers/watchdog/asm9260_wdt.c > +++ b/drivers/watchdog/asm9260_wdt.c > @@ -292,14 +292,14 @@ static int asm9260_wdt_probe(struct platform_device *pdev) > if (IS_ERR(priv->iobase)) > return PTR_ERR(priv->iobase); > > - ret = asm9260_wdt_get_dt_clks(priv); > - if (ret) > - return ret; > - > priv->rst = devm_reset_control_get_exclusive(&pdev->dev, "wdt_rst"); > if (IS_ERR(priv->rst)) > return PTR_ERR(priv->rst); > > + ret = asm9260_wdt_get_dt_clks(priv); > + if (ret) > + return ret; > + > wdd = &priv->wdd; > wdd->info = &asm9260_wdt_ident; > wdd->ops = &asm9260_wdt_ops;