From patchwork Thu Jul 31 21:43:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Humberto Naves X-Patchwork-Id: 4659211 Return-Path: X-Original-To: patchwork-linux-arm@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 DE3C19F2B8 for ; Thu, 31 Jul 2014 21:46:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A1882017A for ; Thu, 31 Jul 2014 21:46:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6C852015E for ; Thu, 31 Jul 2014 21:46:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCy8s-0003DH-K0; Thu, 31 Jul 2014 21:44:06 +0000 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCy8p-00039w-DK for linux-arm-kernel@lists.infradead.org; Thu, 31 Jul 2014 21:44:03 +0000 Received: by mail-wg0-f50.google.com with SMTP id n12so3337919wgh.21 for ; Thu, 31 Jul 2014 14:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=TQP1HtmfnuzZuYQRBILfZL7UldbvYa351nSm8dbdT1M=; b=SpuFiH6te7IT9+MjXlIQter9xXoRzbR8RDasNndQqEoyKIg1WeeVBKoTbzxA1gu9Fc 780MlusKwx372flRS00QUreIcdz5/fNB+yzyuTo6wmbNaQEro+0rJ6VIwIqY8MjC0x5C 6u0zM8YiIlqcssuaPwEJPZMDN0j0RsDZtr2Y1oLZUgu+z3jrwVnI1KEZQiIqV2bjaUak u47qzBttnU3TkTLG7eajnclZ8SXygEfg47SmcBn6KsLQreNxqGJpMca16GaRFXYckHRN H+f1TPGXI2wVnpWfZSomA/Nj9YzaQagrJwE2jTKBKA4BzLpCMEJjyEWmCVGa6N1uPYHR 2sGQ== X-Received: by 10.194.191.162 with SMTP id gz2mr1436118wjc.89.1406843021120; Thu, 31 Jul 2014 14:43:41 -0700 (PDT) Received: from localhost.localdomain (84-73-200-99.dclient.hispeed.ch. [84.73.200.99]) by mx.google.com with ESMTPSA id h3sm16073627wjz.48.2014.07.31.14.43.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jul 2014 14:43:40 -0700 (PDT) From: Humberto Silva Naves To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] clk: samsung: Changed return behavior of samsung_clk_init Date: Thu, 31 Jul 2014 23:43:21 +0200 Message-Id: <1406843002-15652-1-git-send-email-hsnaves@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140731_144403_599601_EEFBD27C X-CRM114-Status: GOOD ( 13.08 ) X-Spam-Score: -0.8 (/) Cc: Humberto Silva Naves , Kukjin Kim , Tomasz Figa , linux-kernel@vger.kernel.org, Andreas Farber , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Instead of invoking panic, the samsung_clk_init returns a NULL pointer to indicate that an error has occurred. All the drivers using this function were changed appropriately (in this case just the clk-exynos5410). This patch was suggested by Tomasz Figa in http://www.mail-archive.com/linux-samsung-soc@vger.kernel.org/msg34982.html Signed-off-by: Humberto Silva Naves --- drivers/clk/samsung/clk-exynos5410.c | 2 ++ drivers/clk/samsung/clk.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c index 231475b..19657b4 100644 --- a/drivers/clk/samsung/clk-exynos5410.c +++ b/drivers/clk/samsung/clk-exynos5410.c @@ -193,6 +193,8 @@ static void __init exynos5410_clk_init(struct device_node *np) panic("%s: failed to map registers\n", __func__); ctx = samsung_clk_init(np, reg_base, CLK_NR_CLKS); + if (!ctx) + panic("%s: unable to allocate context.\n", __func__); samsung_clk_register_pll(ctx, exynos5410_plls, ARRAY_SIZE(exynos5410_plls), reg_base); diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index deab84d..0cf0ec6 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -57,11 +57,13 @@ struct samsung_clk_provider *__init samsung_clk_init(struct device_node *np, ctx = kzalloc(sizeof(struct samsung_clk_provider), GFP_KERNEL); if (!ctx) - panic("could not allocate clock provider context.\n"); + return NULL; clk_table = kcalloc(nr_clks, sizeof(struct clk *), GFP_KERNEL); - if (!clk_table) - panic("could not allocate clock lookup table\n"); + if (!clk_table) { + kfree(ctx); + return NULL; + } for (i = 0; i < nr_clks; ++i) clk_table[i] = ERR_PTR(-ENOENT);