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: 4659191 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3D88C0338 for ; Thu, 31 Jul 2014 21:43:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 13B38201B9 for ; Thu, 31 Jul 2014 21:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8B032017A for ; Thu, 31 Jul 2014 21:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752781AbaGaVnn (ORCPT ); Thu, 31 Jul 2014 17:43:43 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:54199 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752751AbaGaVnm (ORCPT ); Thu, 31 Jul 2014 17:43:42 -0400 Received: by mail-wi0-f175.google.com with SMTP id ho1so340655wib.14 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kukjin Kim , Tomasz Figa , Andreas Farber , Humberto Silva Naves 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 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.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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);