Received: by 10.223.176.5 with SMTP id f5csp1173819wra; Fri, 9 Feb 2018 13:58:46 -0800 (PST) X-Google-Smtp-Source: AH8x227MMnJRUl0xt5047cJK7h3DOg8ZmeFewaHdlL3DzuZxRXw7ONN12kHT//GHE1riJ43Kx6bo X-Received: by 2002:a17:902:a03:: with SMTP id 3-v6mr3825196plo.282.1518213526472; Fri, 09 Feb 2018 13:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518213526; cv=none; d=google.com; s=arc-20160816; b=EXAU4d/foaWOipgyrA2wR5NnN4vz6pNGGpj/8B36k9Dy7guuCUEzf8YCXd1KZsVhN+ Qq1s0r/Ut6KKTtCS/ifhMr1j9NV3Yiobay1Hs2lpWr4FuBXbMPSzzVTOJnvCYS90T9EL fTMCuGH/+b1tHWC3kK94nFiRUzoGHmP1cfyiGKY0EDnK8cLIvriyXZ7Fg8K2x1/ykB7T kXnkYga+RIVci1+NQdKo5VNDqKQjvZNemSK4J/TXy5uHYCcpSlE+sltttXMd2djWjR69 GkprBsKJ9YJu6C0JqCwi+q3s6EnXiRtrW880H8ZXVB7FecAaD3bkEgZTnBOCPM1TloV5 tXPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=0GG4whNCOLTY/d1Hgp1XnApVPrio1TwE6rWTNFph5Fo=; b=g93NeXLdkIOd69aPOC11gdvQE0uolRwvrHBtOZubdM7KrhDZGk3y8audcRS9Ps91xy +WGbC0PuVMQ7A0G3BGrJOc7bIfmHUfp8ax+YZ02XNAKAk8tuTukdxVTHJeYDQpFrDSth Js80voOgAyBb2VWEAO5VDYeTmvQu5BvUm+rslxvtfRveGPg7/hktTQFEKcFpUaJgueiB YmWEYP4SOxJZZwtgbLVHdz7/Szv6dFGTaRYPnaQJBfTB5gNxOSSGu5Lx1DQynpAz4zh/ dlEBsEwpqRYL2t3mJLs6G5iboDqfjMY+DJrBbfL579EOyka0KMswRpbK6ItUTbO8ufiF f7Gw== 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 e6-v6si2095723plo.702.2018.02.09.13.58.32; Fri, 09 Feb 2018 13:58:46 -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 S1753086AbeBIV4o (ORCPT + 99 others); Fri, 9 Feb 2018 16:56:44 -0500 Received: from mail.ispras.ru ([83.149.199.45]:41872 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752893AbeBIV4n (ORCPT ); Fri, 9 Feb 2018 16:56:43 -0500 Received: from localhost.localdomain (ppp85-140-182-254.pppoe.mtu-net.ru [85.140.182.254]) by mail.ispras.ru (Postfix) with ESMTPSA id 5590854006A; Sat, 10 Feb 2018 00:56:41 +0300 (MSK) From: Alexey Khoroshilov To: Wim Van Sebroeck , Guenter Roeck Cc: Alexey Khoroshilov , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: [PATCH] watchdog: asm9260_wdt: fix error handling in asm9260_wdt_probe() Date: Sat, 10 Feb 2018 00:56:29 +0300 Message-Id: <1518213389-19246-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 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. 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; + } wdd = &priv->wdd; wdd->info = &asm9260_wdt_ident; -- 2.7.4