From patchwork Wed Apr 20 14:37:56 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: 8890531 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9637CBF29F for ; Wed, 20 Apr 2016 14:38:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9C1E2024C for ; Wed, 20 Apr 2016 14:38:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F19642012B for ; Wed, 20 Apr 2016 14:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932985AbcDTOiZ (ORCPT ); Wed, 20 Apr 2016 10:38:25 -0400 Received: from lists.s-osg.org ([54.187.51.154]:50938 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752893AbcDTOiX (ORCPT ); Wed, 20 Apr 2016 10:38:23 -0400 Received: from localhost.localdomain.com (host-202.58.217.201.copaco.com.py [201.217.58.202]) by lists.s-osg.org (Postfix) with ESMTPSA id 16A47E2895; Wed, 20 Apr 2016 14:38:22 +0000 (UTC) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Javier Martinez Canillas , linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski , Wolfram Sang , Kukjin Kim , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/2] i2c: s3c2410: Check clk_prepare_enable() return value Date: Wed, 20 Apr 2016 10:37:56 -0400 Message-Id: <1461163076-5959-2-git-send-email-javier@osg.samsung.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1461163076-5959-1-git-send-email-javier@osg.samsung.com> References: <1461163076-5959-1-git-send-email-javier@osg.samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 Reviewed-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski --- Changes in v2: - Don't print the errno code since that's already printed by the core when probe fails. Suggested by Krzysztof Kozlowski. drivers/i2c/busses/i2c-s3c2410.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 13f67df65c45..8a9ea0c1e41d 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1196,7 +1196,12 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) /* initialise the i2c controller */ - clk_prepare_enable(i2c->clk); + ret = clk_prepare_enable(i2c->clk); + if (ret) { + dev_err(&pdev->dev, "I2C clock enable failed\n"); + return ret; + } + ret = s3c24xx_i2c_init(i2c); clk_disable(i2c->clk); if (ret != 0) {