From patchwork Sat Jun 21 10:32:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 4393671 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B37EC9F314 for ; Sat, 21 Jun 2014 10:32:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0572202FF for ; Sat, 21 Jun 2014 10:32:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA67920340 for ; Sat, 21 Jun 2014 10:32:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754899AbaFUKca (ORCPT ); Sat, 21 Jun 2014 06:32:30 -0400 Received: from gw-1.arm.linux.org.uk ([78.32.30.217]:37763 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754806AbaFUKca (ORCPT ); Sat, 21 Jun 2014 06:32:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From; bh=eB9yYF1RqbBN/bfwqliKCaoUQ1OgVMnGZ4oXaWmGmO4=; b=oWQbBRWqpldDNBQk2pO6GhoE2qKA3r1vme4H2S1HwhgdcLigkKq1DVUBCfSIGOftqzgxbSpDKQ8cB2rByehAnk4fQ3+YNZ8popwYVIhdjlyj26J4vMyhHEBT4VUJf74O1iNq07zMkfvme1+fOvx7cAqZPAvySed6VOI+xiYBALY=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36962 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1WyIat-0002c4-UZ; Sat, 21 Jun 2014 11:32:23 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1WyIat-0008KL-Ju; Sat, 21 Jun 2014 11:32:23 +0100 From: Russell King To: Mark Brown , Andrew Lunn , Jason Cooper Cc: linux-spi@vger.kernel.org Subject: [PATCH] SPI: spi-orion: check return value from clk_prepare()/clk_enable() Message-Id: Date: Sat, 21 Jun 2014 11:32:23 +0100 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk_prepare()/clk_enable() can fail, and it's return value should be checked. Add the proper checking, and while we're here, convert to clk_prepare_enable(). Signed-off-by: Russell King --- Patch generated against v3.15 drivers/spi/spi-orion.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index d018a4aac3a1..24844984ef36 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -382,8 +382,10 @@ static int orion_spi_probe(struct platform_device *pdev) goto out; } - clk_prepare(spi->clk); - clk_enable(spi->clk); + status = clk_prepare_enable(spi->clk); + if (status) + goto out; + tclk_hz = clk_get_rate(spi->clk); master->max_speed_hz = DIV_ROUND_UP(tclk_hz, 4); master->min_speed_hz = DIV_ROUND_UP(tclk_hz, 30);