Received: by 10.223.185.116 with SMTP id b49csp61030wrg; Sat, 10 Feb 2018 02:22:30 -0800 (PST) X-Google-Smtp-Source: AH8x225pV69FxqM4W865jO8IHLzhLWBMYB33pFnD5+vv5aJbwshZLTrRbe9gCUueUXaQ40IQtDWB X-Received: by 10.99.7.4 with SMTP id 4mr4625712pgh.73.1518258149970; Sat, 10 Feb 2018 02:22:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518258149; cv=none; d=google.com; s=arc-20160816; b=bnBY0efDGaaTS3M1inOShDNRKpxq2k+un/bKF44wiKO/oR1HWN0IeEETdHbU63G4aL xidbYPPZXLSJROsSM5Wl7ofN1XcwkOe3p4mPxGfyayv49wgGOoVLgjUfJFiLt56k6krQ Jq12M4tLAeGWeBn41brZ7UYuVuM7RZZdDUVj0Q0ugkvE5G7CT4wt7cO0aylOdA4QR0BY vI3/OfCCYXfRLXFTsBdB7V9fag6Ragn66lhD+DkEm9D9Ce9Qd+amVNtaVJE7XRZmDZNY ZDR6zTnrXPxMrQBrsuvmdU2FEI+0zPEJUY+Mhu7HohVKjNL029qWS9mDax/BgoQL+n57 Q7lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:message-id:date:subject:cc:to :from:arc-authentication-results; bh=iCZgOUxUACLGLK7oi1njTxIJf/vhD4QPJ5y9pga52NQ=; b=JDY2E/kQpDNiJJxDHJrwoqfajMRnMAMZaXYbSoK1SnyUIOnlRV/KLSsnBLSQRg/MNW 9x+U4kZxdd7vGpgAyYYt5Z+hckOLwv0YhMxoaNjsRZZFNQJfSJWtV0wLbz+iTOAjWySG Y6E25tQsn83YSJETxUtgh/9UcboPSZQjcaJPsr9ajtYKslq5YnoonXkAVEuSVOKmYLWE cnsQ/NTSCdvSGKsqK3KXz6QUW9y+Po0hAv5TdrsomFifw7VA/+eAbiyiezEJWXeecoFA SilYaG9chP8VF4cn3P094dlcpmlxH/UNSrFZXOHF3VJXZ6ne8HNBCkd1MtpNCvLAqHR/ 5Teg== 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 u1-v6si2871105plb.740.2018.02.10.02.21.40; Sat, 10 Feb 2018 02:22:29 -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; 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 S1751208AbeBJKRv (ORCPT + 99 others); Sat, 10 Feb 2018 05:17:51 -0500 Received: from mail.ispras.ru ([83.149.199.45]:44232 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeBJKRt (ORCPT ); Sat, 10 Feb 2018 05:17:49 -0500 Received: from localhost.localdomain (unknown [85.140.187.26]) by mail.ispras.ru (Postfix) with ESMTPSA id 92B6454006A; Sat, 10 Feb 2018 13:17:47 +0300 (MSK) From: Alexey Khoroshilov To: Guenter Roeck , Wim Van Sebroeck Cc: Alexey Khoroshilov , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH v2] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe() Date: Sat, 10 Feb 2018 13:17:27 +0300 Message-Id: <1518257847-28796-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20180209223209.GA19627@roeck-us.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.7.4