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: 9300863 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 81194607F0 for ; Fri, 26 Aug 2016 07:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65C4629508 for ; Fri, 26 Aug 2016 07:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A44529542; Fri, 26 Aug 2016 07:10: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 940E529508 for ; Fri, 26 Aug 2016 07:10:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750700AbcHZHK0 (ORCPT ); Fri, 26 Aug 2016 03:10:26 -0400 Received: from andre.telenet-ops.be ([195.130.132.53]:45364 "EHLO andre.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750698AbcHZHKZ (ORCPT ); Fri, 26 Aug 2016 03:10:25 -0400 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 Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Geert Uytterhoeven 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 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.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".