Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1112189imm; Wed, 1 Aug 2018 10:22:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcyaYOt/0jDxGPXHNbxsi0kfLb1UNjHZPdgNCfbG3nqQGUpgG37BIyFthFdIpGpqkJZ9gEp X-Received: by 2002:a65:64d7:: with SMTP id t23-v6mr25963178pgv.207.1533144160425; Wed, 01 Aug 2018 10:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144160; cv=none; d=google.com; s=arc-20160816; b=A1oSHaLVNsiCDsCmdCPSHEWV1Z/zEWkvJVtcs0gC4pzibnkd5hKQizXORCG8imjp5L 7idBhV3EM35PV9noXN99KkPKyQYF4wKJGV85Bdq504YgDxIZ60sKOaoGxYyFdpWDvgHD V7fz7C1Xx07T3jjoHeLO1ZetVClZdGciz4X5fk8mcpqDXo1CzqtGJkxGU97lkiMNRZyT IBK35Zhh2j6nZnGuZbTZj67v3Hnq2oASNAsmElWxvv88214KH6ZU3GT5Ex8cMxgsLFUK UNap7rxLEqV9JCIxtrxvPj0SPZ0oDPTyqUHyH/AYBEPIUo/duU9b2Yj78jGVceBNINBs OM8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6xTnRdikOSWdyJbcQ87uIRhR3mGxDpfQKvoQzL5jUbY=; b=HNlCTxi0LqrX9P8GIiaFOp9IqWPLugBoDycxZUJsPuwOkRwQA4ZAr2ZcBX3x3XyZUN 9ppgqNMvuFeJzIG488idtBnlM7EeDR/HDkm67mzzFZPItDmLTQMrH7Q8jToYcbYuZwm7 fRktizxKP2y7C4kOrK7LA22feIeAqpG1vytBLSXzujeJ07LDAa+MlCADaJODlp/5s7hk sUd1VWYqc4fn1GTE8hCjU70x2jDMxcOp55SoHS+LjbBGgRvg2Kd0ZrrKl4PqPaNReuun 1Il/ECpskbt87GUDjwwpVHTfjL4BHrnYgglQaVF58qkRVHp+lGXwXbvJA0WWQU7A7UbI hVuA== 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 x37-v6si15824456pgl.544.2018.08.01.10.22.25; Wed, 01 Aug 2018 10:22:40 -0700 (PDT) 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 S2405460AbeHATHU (ORCPT + 99 others); Wed, 1 Aug 2018 15:07:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49170 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405438AbeHATHT (ORCPT ); Wed, 1 Aug 2018 15:07:19 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 47D8ACC2; Wed, 1 Aug 2018 17:20:38 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Neil Armstrong , Mark Brown , Sasha Levin Subject: [PATCH 4.14 176/246] spi: meson-spicc: Fix error handling in meson_spicc_probe() Date: Wed, 1 Aug 2018 18:51:26 +0200 Message-Id: <20180801165020.149845495@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Khoroshilov [ Upstream commit ded5fa4e8bac25612caab8f0822691308a28a552 ] 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 Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-meson-spicc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -574,10 +574,15 @@ static int meson_spicc_probe(struct plat 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);