From patchwork Fri Dec 9 15:29:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Pagani X-Patchwork-Id: 31832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp842007wrr; Fri, 9 Dec 2022 07:31:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5J6y5ILp1gyyOycHk/fKfkkqwvvS5bdTWBax0QdHG6EQY9pT1A0NgFmL5IK0ONm4WFtNCI X-Received: by 2002:a05:6402:380a:b0:467:7b2e:88a2 with SMTP id es10-20020a056402380a00b004677b2e88a2mr5305980edb.19.1670599879577; Fri, 09 Dec 2022 07:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670599879; cv=none; d=google.com; s=arc-20160816; b=q9ixRnupMY/dsJM3HPvIEhFCHoHslUooCY7rbhcgDlpzrcuFxSm83rj5DaTp5xH7l4 +5c4WPpUzdLlwHzN4H2FWSwa/gzc6sjFfLAWaLn4HutlAMLmyckoVV8uV0X/3slEDtAE qAD5ez4gkskGHTKm+FZVLf0Ec8vmTwWIEvwuZsfuRSaIgJAPevF+qbXMEv7TJcurc0Xo Z2JBi11Vl/QMG1Etf3C08wKy5zL/VCAp57s9EGXF8+D4kDLEviLsm4XzkHNeb9VH6RaM K0o+HJMthM1YCUOscJM10uOwiFeZQW5C874SZleMypQ6WttOTp13XZrWMBe3vihw2d3m L8kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RUr5nGjxc+b90ljVLd9eIXOVWRTwlS2fejPnyUptxZ8=; b=d8N7P68y+BWKvBv8uk6A17MwIpiiuQk6Z2itQ/ESCqLT3TGbI8Js0fJ1uPXpEf6oJZ urMTEUjFzAcADBrzeYHSDxQwaTbI74OBidgtFfDFVCJC8l1HljSowlXuqpYSAFa+9pKF 4xFp3ru6jQEB/awYBwNkRkWbjK0RVe8Gm1cXA7gijD6QYDWUFa1W34TOho4UW1xBHfAV bhkmgfYHxvmLzIJc2zZjWyGxzvYF8EuabGCWG1U60ap6neYdKNNpg4RufjM17PvlqsUz H3zIvZUx9ifCXzk9SlEYViHMhYdHEzGHmIuL7EoGOwk/bVOPOYbHpV/TahP4H5WCTuk0 XUeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LAZ28H7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a056402524300b004696af1a86fsi1920174edd.271.2022.12.09.07.30.54; Fri, 09 Dec 2022 07:31:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LAZ28H7C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbiLIPah (ORCPT + 99 others); Fri, 9 Dec 2022 10:30:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbiLIPa3 (ORCPT ); Fri, 9 Dec 2022 10:30:29 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE048F70A for ; Fri, 9 Dec 2022 07:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RUr5nGjxc+b90ljVLd9eIXOVWRTwlS2fejPnyUptxZ8=; b=LAZ28H7CuafDG9I+QfTI8wHZ4q+9cL20bY01da1s5tb/MaOimVM4v6sJ0qAvbbUoCEaRL8 UPDHko1He+eT5aATopSQ08EGAtPUhV/mD43gMx20fVhtNbXbWe57/Csv2hHWw4OwCChwAE /xy0SsrxJii6z2JdSfir9FBGxaEhQ6c= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-470-C9a3L82FO6Wp3Wtubq2EGg-1; Fri, 09 Dec 2022 10:29:24 -0500 X-MC-Unique: C9a3L82FO6Wp3Wtubq2EGg-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-40306a5a42cso53482267b3.1 for ; Fri, 09 Dec 2022 07:29:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RUr5nGjxc+b90ljVLd9eIXOVWRTwlS2fejPnyUptxZ8=; b=RerroyEGl9Il403VgNRcBvaCDpOg/9lpK4Agw0dBZCOlZJvb24rPzREfMRnc/IQ7/d nB0YZ19Gviu/LLG961Q44dwS/TFNcHDiUwNb5jnsAmefWp6QRkRgtsfIuXdUNcCjz14d EQ/E6iEJUtNWx9WOccSgQVgqS/Z4Y10Qqd4tXapHLq+FNV8LmBpepPBgbhIJks8LVF5v CZ1FVfFuE1Vr2/Lo+c6fDDItIEy2MbGs/j1ZeX8uYTyZN/gZaM63OxFEEO9Abxsg9P8q 3og2K6ozcSVWnFb7vUr0OZzFTnujRJDrELwIksfWeHj05J211B1wklt9dEdyrsVWAl1o hrUg== X-Gm-Message-State: ANoB5pm2KfnRiSEhAu3P4FE21qdD9SxMpZi2gI9wCWU086g4hXDTXlmA MpS2loqMboV+roIoPuOImcLRprAmNvE4AxXGCiy8sKo/RMLTBc3vp2oJihcit9LAI5cDh4vYRkI xeUNfR30nnKkCXcUO2xQl3+o= X-Received: by 2002:a25:b943:0:b0:702:61d3:e1c7 with SMTP id s3-20020a25b943000000b0070261d3e1c7mr5582490ybm.16.1670599763166; Fri, 09 Dec 2022 07:29:23 -0800 (PST) X-Received: by 2002:a25:b943:0:b0:702:61d3:e1c7 with SMTP id s3-20020a25b943000000b0070261d3e1c7mr5582469ybm.16.1670599762887; Fri, 09 Dec 2022 07:29:22 -0800 (PST) Received: from klayman.redhat.com (net-2-34-28-158.cust.vodafonedsl.it. [2.34.28.158]) by smtp.gmail.com with ESMTPSA id dt26-20020a05620a479a00b006fbf88667bcsm29484qkb.77.2022.12.09.07.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:22 -0800 (PST) From: Marco Pagani To: Dinh Nguyen , Michael Turquette , Stephen Boyd Cc: Marco Pagani , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:09 +0100 Message-Id: <20221209152913.1335068-3-marpagan@redhat.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209152913.1335068-1-marpagan@redhat.com> References: <20221209152913.1335068-1-marpagan@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751750917263050843?= X-GMAIL-MSGID: =?utf-8?q?1751750939261837695?= The function of_clk_add_provider() has been deprecated, so use its suggested replacement of_clk_add_hw_provider() instead. Since of_clk_add_hw_provider() can fail, like of_clk_add_provider(), check its return value and do the error handling. The indentation of the init function parameters has been aligned to match open parenthesis, as suggested by checkpatch, and the __init macro moved before the function name, as specified in init.h. Signed-off-by: Marco Pagani --- drivers/clk/socfpga/clk-periph-a10.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/clk/socfpga/clk-periph-a10.c b/drivers/clk/socfpga/clk-periph-a10.c index b9cdde4b8441..64cc70b970b7 100644 --- a/drivers/clk/socfpga/clk-periph-a10.c +++ b/drivers/clk/socfpga/clk-periph-a10.c @@ -57,8 +57,8 @@ static const struct clk_ops periclk_ops = { .get_parent = clk_periclk_get_parent, }; -static __init void __socfpga_periph_init(struct device_node *node, - const struct clk_ops *ops) +static void __init __socfpga_periph_init(struct device_node *node, + const struct clk_ops *ops) { u32 reg; struct clk_hw *hw_clk; @@ -106,21 +106,25 @@ static __init void __socfpga_periph_init(struct device_node *node, hw_clk = &periph_clk->hw.hw; - if (clk_hw_register(NULL, hw_clk)) { - kfree(periph_clk); - return; + rc = clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - if (rc < 0) { + + rc = of_clk_add_hw_provider(node, of_clk_hw_simple_get, hw_clk); + if (rc) { pr_err("Could not register clock provider for node:%s\n", clk_name); - goto err_clk; + goto err_of_clk_add_hw_provider; } return; -err_clk: +err_of_clk_add_hw_provider: clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(periph_clk); } void __init socfpga_a10_periph_init(struct device_node *node)