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: 10370423 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 39F7B60116 for ; Sat, 28 Apr 2018 22:47:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2821228BE9 for ; Sat, 28 Apr 2018 22:47:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C22F28C1C; Sat, 28 Apr 2018 22:47:11 +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 9718728BE9 for ; Sat, 28 Apr 2018 22:47:10 +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=xNv5odo5AjoPFmbeoQTs3e+u6YZzdGYXCsUzza/ki80=; b=Rae maZS8AhDvZyuvxU59UwkiVjlptVduhNCfpK5MPvP1OYjex8I8YseT61IeUujQ91aciz4B7m9aN6bW 71KFvNFclakjoY4ui2Whc75TL0Sx9T4PFZixtAUTh8BjlZ2j26gi3f9xQUuDnb7sFdNKK99vPcB39 1EQBySTgwOp+lkEbP9+GXU0+74jsIi5vCB+TNqAHLCw1EeMeRgUoFyN0KwD0ZcmZWeyKGUh9wUeUb 5Lqc4+yiIFSZn0dHXuioSYwbRtk31sTgrR7nP5ZIx5UiNjKKW5llGc5p+jldmCQ2WJJG22iVExmHO w4WGOwsiJp2BUP2HzaJvDabBfQHBR/g==; 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 1fCYcN-0003SC-Fw; Sat, 28 Apr 2018 22:46:59 +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-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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);