From patchwork Fri Aug 26 07:10:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9300891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 96F15607F0 for ; Fri, 26 Aug 2016 07:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8606229541 for ; Fri, 26 Aug 2016 07:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7ABF929545; Fri, 26 Aug 2016 07:12:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77D7629541 for ; Fri, 26 Aug 2016 07:12:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bdBHw-0002vI-GY; Fri, 26 Aug 2016 07:10:52 +0000 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bdBHr-0002t9-Jg for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2016 07:10:49 +0000 Received: from ayla.of.borg ([84.193.137.253]) by andre.telenet-ops.be with bizsmtp id bjAM1t00U5UCtCs01jAMHZ; Fri, 26 Aug 2016 09:10:23 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1bdBHR-0005em-93; Fri, 26 Aug 2016 09:10:21 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1bdBHU-0003im-2H; Fri, 26 Aug 2016 09:10:24 +0200 From: Geert Uytterhoeven To: Russell King , Michael Turquette , Stephen Boyd Subject: [PATCH] clkdev: Detect errors in clk_hw_register_clkdev() for mass registration Date: Fri, 26 Aug 2016 09:10:09 +0200 Message-Id: <1472195409-14268-1-git-send-email-geert@linux-m68k.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160826_001047_863826_BACFC115 X-CRM114-Status: UNSURE ( 7.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Geert Uytterhoeven , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Unlike clkdev_create(), clkdev_hw_create() doesn't check for passed error objects from a previous registration call. Hence the caller of clk_hw_register_*() had to check for errors before calling clkdev_hw_create*(). Make clkdev_hw_create() more similar to clkdev_create() by adding this error check, removing the burden from callers that do mass registration. Fixes: e4f1b49bda6d6aa2 ("clkdev: Add clk_hw based registration APIs") Fixes: 944b9a41e004534f ("clk: ls1x: Migrate to clk_hw based OF and registration APIs") Signed-off-by: Geert Uytterhoeven --- drivers/clk/clkdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index 97ae60fa15849954..bb8a77a5985f8627 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -448,12 +448,20 @@ EXPORT_SYMBOL(clk_register_clkdev); * * con_id or dev_id may be NULL as a wildcard, just as in the rest of * clkdev. + * + * To make things easier for mass registration, we detect error clk_hws + * from a previous clk_hw_register_*() call, and return the error code for + * those. This is to permit this function to be called immediately + * after clk_hw_register_*(). */ int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id, const char *dev_id) { struct clk_lookup *cl; + if (IS_ERR(hw)) + return PTR_ERR(hw); + /* * Since dev_id can be NULL, and NULL is handled specially, we must * pass it as either a NULL format string, or with "%s".