From patchwork Thu Feb 6 18:33:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 3597711 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 92BF19F2F5 for ; Thu, 6 Feb 2014 18:34:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C700C2010C for ; Thu, 6 Feb 2014 18:34:13 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 C9C922010B for ; Thu, 6 Feb 2014 18:34:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBTlo-0007Ui-H7; Thu, 06 Feb 2014 18:33:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBTlm-0008HW-8i; Thu, 06 Feb 2014 18:33:50 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WBTlh-0008H0-M2 for linux-arm-kernel@lists.infradead.org; Thu, 06 Feb 2014 18:33:47 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N0L00IS57JIXIA0@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 06 Feb 2014 18:33:18 +0000 (GMT) X-AuditID: cbfec7f4-b7f796d000005a13-9b-52f3d57172cb Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 4F.6C.23059.175D3F25; Thu, 06 Feb 2014 18:33:21 +0000 (GMT) Received: from AMDC1227.digital.local ([106.116.147.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N0L00I7J7JIFN10@eusync1.samsung.com>; Thu, 06 Feb 2014 18:33:21 +0000 (GMT) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] clk: samsung: Initialize clock table with error pointers Date: Thu, 06 Feb 2014 19:33:11 +0100 Message-id: <1391711591-19416-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.5.2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBJMWRmVeSWpSXmKPExsVy+t/xy7qFVz8HGWx+rWRxtukNu8Wmx9dY LWac38dksfbIXXaLpxMuslkcftPOarF+xmsWB3aPO9f2sHlsXlLv0bdlFaPH501yASxRXDYp qTmZZalF+nYJXBk7Di9iKZjCWfFj12S2Bsb97F2MnBwSAiYSX1deYoKwxSQu3FvP1sXIxSEk sJRR4uTVqewQTh+TxISnf9lAqtgE1CQ+NzwCs0UEVCU+ty0AK2IW+M8oMf/DdUaQhLCAp8Th 49/AbBagoi+3d4Ct4BVwkjh69RZQnANonYLE6utCExi5FzAyrGIUTS1NLihOSs811CtOzC0u zUvXS87P3cQICY0vOxgXH7M6xCjAwajEw3ti6ecgIdbEsuLK3EOMEhzMSiK8mnuBQrwpiZVV qUX58UWlOanFhxiZODilGhiVdzgFrF45o7Dim+jv26+4Vk0+t/go38b1eT3vMmKP2rH3r9lo HH35z84s8/vx1zJir3JdvOafu61kduf+oKLrmy1kJUIeTNxdrpK9a95hvtULJTi1Nd2XRYjs 3rht/6HqOr+dn2Nt/BTUVYqnzH50vfOA2dSV4UK/ePbULH/yzeDPoa/XQq+rK7EUZyQaajEX FScCAIiU8QTrAQAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140206_133345_807313_E78F3227 X-CRM114-Status: UNSURE ( 8.33 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -7.4 (-------) Cc: Mike Turquette , Tomasz Figa , Kyungmin Park , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Before this patch, the driver was simply zeroing the clock table, which is incorrect, because invalid clock numbers returned NULL instead of error pointers. This patch fixes this by changing the driver to initialize the array with PTR_ERR(-ENOENT). Signed-off-by: Tomasz Figa Acked-by: Kyungmin Park Reviewed-by: Sylwester Nawrocki --- drivers/clk/samsung/clk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 91bec3e..f3a71d0 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -58,12 +58,17 @@ struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( void __init samsung_clk_init(struct device_node *np, void __iomem *base, unsigned long nr_clks) { + int i; + reg_base = base; - clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); + clk_table = kmalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); if (!clk_table) panic("could not allocate clock lookup table\n"); + for (i = 0; i < nr_clks; ++i) + clk_table[i] = ERR_PTR(-ENOENT); + if (!np) return;