From patchwork Sat Apr 28 22:46:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 10370421 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D04E3601BE for ; Sat, 28 Apr 2018 22:46:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE3C528BE9 for ; Sat, 28 Apr 2018 22:46:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B25B928C1C; Sat, 28 Apr 2018 22:46:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 23EC828BE9 for ; Sat, 28 Apr 2018 22:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: References:List-Owner; bh=7jhWCnLEtInShyuOPQQupbO1e9Enp+BBAZ1dps8opeo=; b=my9 8v7p/K4intesNYm/P+Jkj6/PioImpPn0Am8Q7USFCvFkhD8kvxCv396aBQigNLGhSJugU3HRhiRFp hZD1ZPZbiWMUEWOWbJx7QxW9WpK5+ImnSYKcz32yTccfcKRqq4RNcnyRwcz1VclDEs6dGChK3Ezbk 370QokF8f7yLll9WA644kJ9qIRIoSLTIXpQD8/GqOaGfge6WVjw2dy3/qua04Q4ddJKz7nWhvtMsl NFzStLH2ChO2OiIuDtN6Uzq+O0fWGjJejVDGXhfLYKZmerHz/KGqSMw7c8iVQzQyRQOhcd5cAzw8u vZNMasb7Fdy8J00YQZTTjcDSeuWdpMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCYcJ-0003Ra-Kr; Sat, 28 Apr 2018 22:46:55 +0000 Received: from mail.ispras.ru ([83.149.199.45]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCYcF-0003Pv-FG; Sat, 28 Apr 2018 22:46:53 +0000 Received: from localhost.localdomain (ppp85-140-190-135.pppoe.mtu-net.ru [85.140.190.135]) by mail.ispras.ru (Postfix) with ESMTPSA id AAF735400C3; Sun, 29 Apr 2018 01:46:32 +0300 (MSK) From: Alexey Khoroshilov To: Mark Brown , Neil Armstrong Subject: [PATCH v2] spi: meson-spicc: Fix error handling in meson_spicc_probe() Date: Sun, 29 Apr 2018 01:46:23 +0300 Message-Id: <1524955583-22760-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180428_154651_714813_15AE7FDD X-CRM114-Status: UNSURE ( 7.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ldv-project@linuxtesting.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Alexey Khoroshilov , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If devm_spi_register_master() fails in meson_spicc_probe(), spicc->core is left undisabled. The patch fixes that. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov Reviewed-by: Neil Armstrong --- v2: Fix subject as Neil Armstrong noted. drivers/spi/spi-meson-spicc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index 5c82910e3480..7fe4488ace57 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -574,10 +574,15 @@ static int meson_spicc_probe(struct platform_device *pdev) master->max_speed_hz = rate >> 2; ret = devm_spi_register_master(&pdev->dev, master); - if (!ret) - return 0; + if (ret) { + dev_err(&pdev->dev, "spi master registration failed\n"); + goto out_clk; + } - dev_err(&pdev->dev, "spi master registration failed\n"); + return 0; + +out_clk: + clk_disable_unprepare(spicc->core); out_master: spi_master_put(master);