From patchwork Wed Apr 20 15:16:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 8891111 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E7779F1C1 for ; Wed, 20 Apr 2016 15:17:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BBA9D20268 for ; Wed, 20 Apr 2016 15:17:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D78CE201FA for ; Wed, 20 Apr 2016 15:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbcDTPRE (ORCPT ); Wed, 20 Apr 2016 11:17:04 -0400 Received: from lists.s-osg.org ([54.187.51.154]:51149 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbcDTPRB (ORCPT ); Wed, 20 Apr 2016 11:17:01 -0400 Received: from localhost.localdomain.com (host-228.58.217.201.copaco.com.py [201.217.58.228]) by lists.s-osg.org (Postfix) with ESMTPSA id 5D4C4E2895; Wed, 20 Apr 2016 15:17:02 +0000 (UTC) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , linux-omap@vger.kernel.org, Tony Lindgren , Lee Jones Subject: [PATCH 2/2] mfd: twl6040: Check clk_prepare_enable() return value in twl6040_power() Date: Wed, 20 Apr 2016 11:16:38 -0400 Message-Id: <1461165398-12289-2-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1461165398-12289-1-git-send-email-javier@osg.samsung.com> References: <1461165398-12289-1-git-send-email-javier@osg.samsung.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The clk_prepare_enable() function can fail so check the return value and propagate the error in case of a failure. Signed-off-by: Javier Martinez Canillas --- drivers/mfd/twl6040.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c index 4de92c16dfb8..852d5874aabb 100644 --- a/drivers/mfd/twl6040.c +++ b/drivers/mfd/twl6040.c @@ -291,7 +291,11 @@ int twl6040_power(struct twl6040 *twl6040, int on) if (twl6040->power_count++) goto out; - clk_prepare_enable(twl6040->clk32k); + ret = clk_prepare_enable(twl6040->clk32k); + if (ret) { + twl6040->power_count = 0; + goto out; + } /* Allow writes to the chip */ regcache_cache_only(twl6040->regmap, false);