From patchwork Sat Jan 11 13:05:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 3474931 Return-Path: X-Original-To: patchwork-linux-pm@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 343739F169 for ; Mon, 13 Jan 2014 12:24:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54A7020121 for ; Mon, 13 Jan 2014 12:24:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0A26F20114 for ; Mon, 13 Jan 2014 12:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751367AbaAMMYm (ORCPT ); Mon, 13 Jan 2014 07:24:42 -0500 Received: from 82-68-191-81.dsl.posilan.com ([82.68.191.81]:48345 "EHLO rainbowdash.ducie.codethink.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751357AbaAMMYl (ORCPT ); Mon, 13 Jan 2014 07:24:41 -0500 X-Greylist: delayed 170333 seconds by postgrey-1.27 at vger.kernel.org; Mon, 13 Jan 2014 07:24:41 EST Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82) (envelope-from ) id 1W1yFz-0005aE-W7; Sat, 11 Jan 2014 13:05:44 +0000 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk Cc: Ben Dooks , "Rafael J. Wysocki" , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] power: clock_ops.c: check return of clk_enable() in pm_clk_resume() Date: Sat, 11 Jan 2014 13:05:39 +0000 Message-Id: <1389445540-21426-2-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1389445540-21426-1-git-send-email-ben.dooks@codethink.co.uk> References: <1389445540-21426-1-git-send-email-ben.dooks@codethink.co.uk> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The clk_enable() call in the pm_clk_resume() call returns an error that is not being checked. If clk_enable() fails then we should not set the state of the clock to PCE_STATUS_ENABLED. Note, the issue of warning the user if this fails has not been addressed in this patch as this is not the only place the driver calls clk_enable(). Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Greg Kroah-Hartman Cc: linux-pm@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ben Dooks Reviewed-by: Ian Molton --- drivers/base/power/clock_ops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index b9dd8fa..9bb95ab 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -252,6 +252,7 @@ int pm_clk_resume(struct device *dev) struct pm_subsys_data *psd = dev_to_psd(dev); struct pm_clock_entry *ce; unsigned long flags; + int ret; dev_dbg(dev, "%s()\n", __func__); @@ -262,8 +263,9 @@ int pm_clk_resume(struct device *dev) list_for_each_entry(ce, &psd->clock_list, node) { if (ce->status < PCE_STATUS_ERROR) { - clk_enable(ce->clk); - ce->status = PCE_STATUS_ENABLED; + ret = clk_enable(ce->clk); + if (ret == 0) + ce->status = PCE_STATUS_ENABLED; } }