Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3312153imu; Sun, 11 Nov 2018 12:08:23 -0800 (PST) X-Google-Smtp-Source: AJdET5dYqM+PnoDS6qfeNld01nag23shkZWxgYf/c+CYttttA4JVdc6BMReOicRV31szbmOmAB1e X-Received: by 2002:a65:42c2:: with SMTP id l2-v6mr14348578pgp.139.1541966903470; Sun, 11 Nov 2018 12:08:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966903; cv=none; d=google.com; s=arc-20160816; b=ERxysIRVEcMMpC5M/nYMu0OSeu3zZL6BwwhdQpmNmORMq5HA3SA9f3RXalNrH4u4EM yGr4IPCAk61ZEqlT9zgZ6bTCpvyO0YSEgBRldMKcaZvgXsBsNVlN43vMv31jVvJkBieu 3LVPP5RtW5DAmx6POAcb8mq8INwgRnRzdBuJdlXuIX/NHwpV9261wgnNtQE7rxamHtnG /dPxOnI93v3Wkkp7HF/UMnadhCq1fICzhrRCtrUdEfY2a+XgNpIBS2Couulokm3E3Cen LCg3ln9zHZbZo/ngNokEKQzpv2u6VwG6AORP0GqY4MHHM7xM86kTeNx3jjFaFVtYPfdz DLNg== 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:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=ajr/IM/sQ35m1bwT0q9M8NKylnbjvRiROqbkkbtgU/M=; b=khWoT95PKqe72tRqnoFGR68lyUeVGqEc7asBYJuJ7Yyf6Tz9xafrBjvNi25Zl3ApPB 4haQL2mroH4nBtsu92EIkS5qlWMULhQdWbers7a74U2WGGacP084g4g5Vw5QJuCm5pqU nkzpKzM4vQipGHrOoio9Zi2B1CTySWzwv7IL6sm4PnkEHCw4KC8OoE6fYSzO/bLjn2ZF Au1143DiOyIEbFrcLP1t9JPywLrpg1Ej/EXI49m3vmGt3G4lg+aZKpd68BjHzjqRk8ET AulzdfOjHYy1xMYI1wb2zvBRIip4UpjN7ZvrJM4AoLR6yYtBHDjFFvhFHNLKhN7rIrb+ 8xgQ== 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 z127-v6si13952166pgb.118.2018.11.11.12.08.08; Sun, 11 Nov 2018 12:08:23 -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 S1731485AbeKLF47 (ORCPT + 99 others); Mon, 12 Nov 2018 00:56:59 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52140 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727208AbeKLF47 (ORCPT ); Mon, 12 Nov 2018 00:56:59 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvtD-0000l9-L9; Sun, 11 Nov 2018 19:59:23 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsO-0001Ol-Cg; Sun, 11 Nov 2018 19:58:32 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Tobias Jordan" , "Mark Brown" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 034/366] spi: pxa2xx: check clk_prepare_enable() return value In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Tobias Jordan commit 62bbc864d1946c715063bd481bff3641fd1324e2 upstream. clk_prepare_enable() can fail, so its return value should be checked and acted upon. Found by Linux Driver Verification project (linuxtesting.org). Fixes: 3343b7a6d2cd ("spi/pxa2xx: convert to the common clk framework") Signed-off-by: Tobias Jordan Signed-off-by: Mark Brown Signed-off-by: Ben Hutchings --- drivers/spi/spi-pxa2xx.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1182,7 +1182,9 @@ static int pxa2xx_spi_probe(struct platf } /* Enable SOC clock */ - clk_prepare_enable(ssp->clk); + status = clk_prepare_enable(ssp->clk); + if (status) + goto out_error_dma_irq_alloc; drv_data->max_clk_rate = clk_get_rate(ssp->clk); @@ -1221,6 +1223,8 @@ static int pxa2xx_spi_probe(struct platf out_error_clock_enabled: clk_disable_unprepare(ssp->clk); + +out_error_dma_irq_alloc: pxa2xx_spi_dma_release(drv_data); free_irq(ssp->irq, drv_data); @@ -1296,8 +1300,11 @@ static int pxa2xx_spi_resume(struct devi pxa2xx_spi_dma_resume(drv_data); /* Enable the SSP clock */ - if (!pm_runtime_suspended(dev)) - clk_prepare_enable(ssp->clk); + if (!pm_runtime_suspended(dev)) { + status = clk_prepare_enable(ssp->clk); + if (status) + return status; + } /* Restore LPSS private register bits */ lpss_ssp_setup(drv_data); @@ -1325,9 +1332,10 @@ static int pxa2xx_spi_runtime_suspend(st static int pxa2xx_spi_runtime_resume(struct device *dev) { struct driver_data *drv_data = dev_get_drvdata(dev); + int status; - clk_prepare_enable(drv_data->ssp->clk); - return 0; + status = clk_prepare_enable(drv_data->ssp->clk); + return status; } #endif