From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A32A9C4332F for ; Fri, 9 Dec 2022 15:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230433AbiLIPag (ORCPT ); Fri, 9 Dec 2022 10:30:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbiLIPa1 (ORCPT ); Fri, 9 Dec 2022 10:30:27 -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 037078F084 for ; Fri, 9 Dec 2022 07:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599763; 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=kBPZbzsz83JkmUujCQ8aIAfFvAeW6uUPjs+rv+f/Muo=; b=WloBNJWLoF1GTTYvEjln8rp/aBcYNX0DpItdY7HbK+REzv0dLFOZekrltDqmLIbEM1FUX/ Zur/swzIJpx4Zlaq72OKypmIboxMkN31Ha5QAz1P8aoUeEm+4KQaRc71xOBF6/dmvZFyv9 iGUsKnoIwaj8b7p2bAzZ3fSSDSI6VCM= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-176-S5V3bL1GMYaWbKcfDHhKDg-1; Fri, 09 Dec 2022 10:29:22 -0500 X-MC-Unique: S5V3bL1GMYaWbKcfDHhKDg-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-360b9418f64so53299837b3.7 for ; Fri, 09 Dec 2022 07:29:21 -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=kBPZbzsz83JkmUujCQ8aIAfFvAeW6uUPjs+rv+f/Muo=; b=RtnMjhEO6/cLQkJvdaXe/vc4mIVsMsxOPRQwUeBohpXIBzSBUl1QT/0Ehx7qeMevWt g2r2noVm2GI0XmW61KmLrgGSfFXVlbVptJ9NahPp9644EdRS7klEHPOvQGeRK9lMg3UG GLTedld8MMGeLqXCODCSAaNYjl+5jJZ4l17foO0ToF7K7IskHipK/hMnTY/BBGgml1dQ SMfSuF7u+/+V6sn4fMoXhbf56odhO1KbWIevM7xtf/5yj0Xib8pRjiYFlwWK46uISsKg ulvdp5WKx4o06UGBj2Hf120bcugfjSdKEq1jo9J3/MTdBi4cUoxt/3tOq/GaS3lOFWyE SBMA== X-Gm-Message-State: ANoB5pktQ3Huizt+xNeL3KwY/UKNFQ2IAX9ZQtyzeFLrKF72tnhkWGsk Emh/0P8YB2hBSAj/dLm0BECOgc4jMCc2uQ+A6hx/hFEO+tN7N94G5XnIFBH+hJ3LTRQ/BZkYOAB /9zHW8P7235za0/QDxxzcqzk= X-Received: by 2002:a25:5686:0:b0:70a:59ae:36ff with SMTP id k128-20020a255686000000b0070a59ae36ffmr8722597ybb.30.1670599761359; Fri, 09 Dec 2022 07:29:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6TPwDlYmGMeDa9q2sZerKMd6y8QUbQ8X3Mt0EEoZ1YwxEOk2JIXziIk2hEwywlYGIehhJh0A== X-Received: by 2002:a25:5686:0:b0:70a:59ae:36ff with SMTP id k128-20020a255686000000b0070a59ae36ffmr8722568ybb.30.1670599761127; Fri, 09 Dec 2022 07:29:21 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:20 -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 1/6] clk: socfpga: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:08 +0100 Message-Id: <20221209152913.1335068-2-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/clk/socfpga/clk-periph.c b/drivers/clk/socfpga/clk-per= iph.c index 43707e2d7248..6a4075147b9c 100644 --- a/drivers/clk/socfpga/clk-periph.c +++ b/drivers/clk/socfpga/clk-periph.c @@ -47,8 +47,8 @@ static const struct clk_ops periclk_ops =3D { .get_parent =3D clk_periclk_get_parent, }; =20 -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; @@ -96,11 +96,25 @@ static __init void __socfpga_periph_init(struct device_= node *node, periph_clk->hw.hw.init =3D &init; hw_clk =3D &periph_clk->hw.hw; =20 - if (clk_hw_register(NULL, hw_clk)) { - kfree(periph_clk); - return; + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; + } + + rc =3D 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_of_clk_add_hw_provider; } - rc =3D of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); + + return; + +err_of_clk_add_hw_provider: + clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(periph_clk); } =20 void __init socfpga_periph_init(struct device_node *node) --=20 2.38.1 From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8709C4332F for ; Fri, 9 Dec 2022 15:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbiLIPai (ORCPT ); Fri, 9 Dec 2022 10:30:38 -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-Google-Smtp-Source: AA0mqf5MOTzDuvvF0acz3hXFcA35QT0x6Hsu7ZE46UCVYvG+2oKgWd/AIf2yB6AiYrkT7BbIK6k3dQ== 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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 =3D { .get_parent =3D clk_periclk_get_parent, }; =20 -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 devic= e_node *node, =20 hw_clk =3D &periph_clk->hw.hw; =20 - if (clk_hw_register(NULL, hw_clk)) { - kfree(periph_clk); - return; + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - rc =3D of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - if (rc < 0) { + + rc =3D 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; } =20 return; =20 -err_clk: +err_of_clk_add_hw_provider: clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(periph_clk); } =20 void __init socfpga_a10_periph_init(struct device_node *node) --=20 2.38.1 From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D46B7C04FDE for ; Fri, 9 Dec 2022 15:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230522AbiLIPas (ORCPT ); Fri, 9 Dec 2022 10:30:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbiLIPad (ORCPT ); Fri, 9 Dec 2022 10:30:33 -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 2445F880DE for ; Fri, 9 Dec 2022 07:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599766; 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=TnfSWneK8MGkHTJmldzwfHxM+WYStFYZRT9qyOXWyWc=; b=OEbQ77Igr6O9Sv1Zu86BhJEK0GVztdbR9EyYp9tjI0SC3yESCUiSO4ax5EHJxzXqHVDVN2 ETTufZ8E0UnvXxnwES5P2BO08MSowlXbfHEhu1GRVeuM+j4CrYy47Els4ig0telaSgt6hg Jc+Yyz6YqyI0bX5wNll0DEpzrCoucfA= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-348-nisF4oQhOVesOeIlhtTr7g-1; Fri, 09 Dec 2022 10:29:25 -0500 X-MC-Unique: nisF4oQhOVesOeIlhtTr7g-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-3d3769a8103so54229347b3.17 for ; Fri, 09 Dec 2022 07:29:25 -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=TnfSWneK8MGkHTJmldzwfHxM+WYStFYZRT9qyOXWyWc=; b=1vk9+o3X6EHvwQVhY7DS/IBKz6z7XztVZdK/HOH1TE4APSW/baGUIiZlnzHynjmXZY lULHdsVCMrl5UcYzzer1xFK9qQs+kqbcAi68D63kcQZQnvjbRBHF/NC5SBhV4fsoRQmh 40jpaygVsLkPmN+LGOncGbtPqOZQOQBDtQaw+UPBaqec0hNh4bwHVUABvDymKtMAyuvp IJP9SxKWgQ7oJsTX5N0/csd390H3B2BuKwcNGllUcDehJwU/OKoSeu1EQcHTPXgRfZwZ 7S+tZXG48FPZn5G0IcPkpHr/kS43ituhZ3LJhmaoHJbBMVOucTspMwQZnWBOndbOFMIs PgcA== X-Gm-Message-State: ANoB5pkyKRKJ0u+eW7MZ3pZRgcq6y3sMwy070YDYdYi29z9Z3N+F8CnU cQXEvxgykytvJQX3bPkhyTDZREKYBi5SbAdCG4nfFxkrDHLB936jWBOgIzXqyGZUvZDGrLk6aK1 LGQ79ACt+VPpYIHwi1992fA8= X-Received: by 2002:a0d:db14:0:b0:369:942d:a53a with SMTP id d20-20020a0ddb14000000b00369942da53amr8672042ywe.24.1670599764996; Fri, 09 Dec 2022 07:29:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JeaOR0EfyY6wPKPH/FTeHYYzcfDIr3yr/PW7r9pEn+HIxT/Holis14oc7KZyf68d2nCBYpw== X-Received: by 2002:a0d:db14:0:b0:369:942d:a53a with SMTP id d20-20020a0ddb14000000b00369942da53amr8672022ywe.24.1670599764793; Fri, 09 Dec 2022 07:29:24 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:24 -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 3/6] clk: socfpga: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:10 +0100 Message-Id: <20221209152913.1335068-4-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 err variable unnecessarily duplicates the functionality of the rc variable, so it has been removed. Signed-off-by: Marco Pagani --- drivers/clk/socfpga/clk-gate.c | 35 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c index 0c18c55edf8c..32ccda960f28 100644 --- a/drivers/clk/socfpga/clk-gate.c +++ b/drivers/clk/socfpga/clk-gate.c @@ -126,17 +126,14 @@ void __init socfpga_gate_init(struct device_node *nod= e) struct clk_init_data init; struct clk_ops *ops; int rc; - int err; =20 socfpga_clk =3D kzalloc(sizeof(*socfpga_clk), GFP_KERNEL); if (WARN_ON(!socfpga_clk)) return; =20 ops =3D kmemdup(&gateclk_ops, sizeof(gateclk_ops), GFP_KERNEL); - if (WARN_ON(!ops)) { - kfree(socfpga_clk); - return; - } + if (WARN_ON(!ops)) + goto err_kmemdup; =20 rc =3D of_property_read_u32_array(node, "clk-gate", clk_gate, 2); if (rc) @@ -182,13 +179,25 @@ void __init socfpga_gate_init(struct device_node *nod= e) =20 hw_clk =3D &socfpga_clk->hw.hw; =20 - err =3D clk_hw_register(NULL, hw_clk); - if (err) { - kfree(ops); - kfree(socfpga_clk); - return; + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - rc =3D of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - if (WARN_ON(rc)) - return; + + rc =3D 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_of_clk_add_hw_provider; + } + + return; + +err_of_clk_add_hw_provider: + clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(ops); +err_kmemdup: + kfree(socfpga_clk); } --=20 2.38.1 From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34DAEC4332F for ; Fri, 9 Dec 2022 15:30:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230477AbiLIPan (ORCPT ); Fri, 9 Dec 2022 10:30:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbiLIPa3 (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.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E6141DF0C for ; Fri, 9 Dec 2022 07:29:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599768; 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=lr1I/+6NJl6q9eP4NAD2iuzXJUU4OlB0nQOPAqBaOdE=; b=LgcKxnb4gv5dOQSNhENKN70U/S4NbpTQMJfkXPxSnEh7ZL4uE7fGPZBNskcMv84txyIffU SrS/RGFWmK7FPwv/PNuD/RChW7LV1ocX0MGu80VrDJTU7jORcBukNj/hPixgMAaoet59WX t34Vq4ew0SpyQaR3uRxaoYdrHJgBCAc= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-1-SLF0HJu_Mneq5wBRveorrA-1; Fri, 09 Dec 2022 10:29:27 -0500 X-MC-Unique: SLF0HJu_Mneq5wBRveorrA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-37360a6236fso53867927b3.12 for ; Fri, 09 Dec 2022 07:29:27 -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=lr1I/+6NJl6q9eP4NAD2iuzXJUU4OlB0nQOPAqBaOdE=; b=DWmJIsLESSZUjTF9qFSycZY4gpcoCVvVkaVdaihQmuVDNLn/3GDU+EDT9arDs5ZK7F 6TCKLB/HN6DFlJdHrxoQxw5ZQ4q9lnW88pm0Xy0qqBOSafRNT//e59KAs+vBv4EGK0gz jV9Qs6EiBQfMxFYywQsGWfSrTr0p1nEukkaje4/E+7osMf9s6foHdm5Ve433zTSVBLKm Dy+tmaqlWjL9fB6zqMpcCxsv6VfcznS6DGiXHxtINs5YXZwR/VsOmcb76UUWmXRokwGs 2pJ1iJTfFtCGjTW6vVKS4QWFKSSbFPeVQQ7ZpBYzB4/LxZaxEm+udhzVSNP8kkRv7zxH JYCg== X-Gm-Message-State: ANoB5pmDA1fFj2yG1P6MsDjJLhRA9kNNgaMFZuPzfhxPz1SfagvYkj4j NyK6XvZrS0PePljLcOZUhZJmRNQ/MT2uWT/JmAFnmzkIQuljvS6eZNBiVHc7/gEKPg3LTyi9MTK wLDTVDyy69yVGqsvyGCPf2Ww= X-Received: by 2002:a25:3c1:0:b0:711:a37b:d738 with SMTP id 184-20020a2503c1000000b00711a37bd738mr4987646ybd.1.1670599766788; Fri, 09 Dec 2022 07:29:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ZJUWfeSaSFSwEQOFa+G+37DwRvr94jg0o73/+tgv7A/3Ara71ex+J6cW4fNuj7wJ9mdAwfQ== X-Received: by 2002:a25:3c1:0:b0:711:a37b:d738 with SMTP id 184-20020a2503c1000000b00711a37bd738mr4987629ybd.1.1670599766591; Fri, 09 Dec 2022 07:29:26 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:26 -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 4/6] clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:11 +0100 Message-Id: <20221209152913.1335068-5-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Marco Pagani --- drivers/clk/socfpga/clk-gate-a10.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-g= ate-a10.c index 7cdf2f07c79b..06f129c160bc 100644 --- a/drivers/clk/socfpga/clk-gate-a10.c +++ b/drivers/clk/socfpga/clk-gate-a10.c @@ -40,7 +40,7 @@ static struct clk_ops gateclk_ops =3D { }; =20 static void __init __socfpga_gate_init(struct device_node *node, - const struct clk_ops *ops) + const struct clk_ops *ops) { u32 clk_gate[2]; u32 div_reg[3]; @@ -94,13 +94,25 @@ static void __init __socfpga_gate_init(struct device_no= de *node, socfpga_clk->hw.hw.init =3D &init; hw_clk =3D &socfpga_clk->hw.hw; =20 - if (clk_hw_register(NULL, hw_clk)) { - kfree(socfpga_clk); - return; + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - rc =3D of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - if (WARN_ON(rc)) - return; + + rc =3D 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_of_clk_add_hw_provider; + } + + return; + +err_of_clk_add_hw_provider: + clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(socfpga_clk); } =20 void __init socfpga_a10_gate_init(struct device_node *node) --=20 2.38.1 From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FB39C4708E for ; Fri, 9 Dec 2022 15:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230427AbiLIPax (ORCPT ); Fri, 9 Dec 2022 10:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbiLIPae (ORCPT ); Fri, 9 Dec 2022 10:30:34 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4381C6300 for ; Fri, 9 Dec 2022 07:29:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599770; 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=78ekr5iKDc85J9/69t3GPkuuIlp1L5lRDkKcFj8Hw1M=; b=AuaCXJ2DWcXa5wttcxjJ2h07eyUZwnecU9FjiML8k0wLsbmmrdTnXnQopHTRU+QnQEgnvL xhGL9pfZNWSwaVvvvWgQDKkQLuL6O4sQ+L2vs15saEiJhk3yQyGRKXSANcPloqrrqWecT1 iu1xiBTow8SacjhB8bDw/4BJ/ywb7QQ= Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-39-S6JZRdKfOMSJwZ7DsVklBQ-1; Fri, 09 Dec 2022 10:29:29 -0500 X-MC-Unique: S6JZRdKfOMSJwZ7DsVklBQ-1 Received: by mail-vs1-f72.google.com with SMTP id n129-20020a677287000000b003b0e74e6491so1338133vsc.19 for ; Fri, 09 Dec 2022 07:29:29 -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=78ekr5iKDc85J9/69t3GPkuuIlp1L5lRDkKcFj8Hw1M=; b=wFrWfITfk2tIh1ukE9+Imw/zZInQODVwMplOB8DU38Jv5UeZ6ZTjf/5sIyqUMXlRoZ +SV3q6VpFmwtQNARWM83K1u9tTvq7Lgz25BI9Es0LoQV4Gp4O2DjVStl2qeyuwiUitZA 2RwfhnTk8Txn8Yg994CPKZPJPT1vkIm3VRXTr9dkatIcsmPuuiwPvSZqNacr3RiMAYIg j+hQDTXHM6QKBCKBvlWQ9lzzd+2oeyhYYWDFWbiixytirO8uejbF3T4zHz9DJBoR9DnV Z0jZI7fhOyQjNO8Y2fF1r6xj3NjqVNdPCCFfDJlzS0i8t3flR7tEDQK56wnUHtyDBMWA qGdA== X-Gm-Message-State: ANoB5pmw6LQqpEPm0w719MUuIJP/qrMnNCfiiVYVYcEquXl6k4X8IHlf EFiQ1BlYYVz6z0qI/e8esgzYHlDwqDxi/RYxPbPgs8nqX4HnyptYGJrD63dwftcu6lYItpsnucv CxHtYORhNkQZANA3T+PdUfBM= X-Received: by 2002:a05:6102:21a6:b0:3b1:33e5:5acb with SMTP id i6-20020a05610221a600b003b133e55acbmr2993341vsb.13.1670599768581; Fri, 09 Dec 2022 07:29:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ky2MlNa+sAz8KiDk6t/+IHaam2m3wqWx48VWywN86MEjgWnUkOfnKKO/ivSY7bjn+JM5uig== X-Received: by 2002:a05:6102:21a6:b0:3b1:33e5:5acb with SMTP id i6-20020a05610221a600b003b133e55acbmr2993326vsb.13.1670599768371; Fri, 09 Dec 2022 07:29:28 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:27 -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 5/6] clk: socfpga: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:12 +0100 Message-Id: <20221209152913.1335068-6-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 return type of the init function has been changed to void since the return value was not used, and the indentation of the parameters has been aligned to match open parenthesis, as suggested by checkpatch. The err variable has been renamed rc for consistency. Signed-off-by: Marco Pagani --- drivers/clk/socfpga/clk-pll.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/drivers/clk/socfpga/clk-pll.c b/drivers/clk/socfpga/clk-pll.c index 127cc849c5ee..9dcc1b2d2cc0 100644 --- a/drivers/clk/socfpga/clk-pll.c +++ b/drivers/clk/socfpga/clk-pll.c @@ -70,8 +70,8 @@ static const struct clk_ops clk_pll_ops =3D { .get_parent =3D clk_pll_get_parent, }; =20 -static __init struct clk_hw *__socfpga_pll_init(struct device_node *node, - const struct clk_ops *ops) +static void __init __socfpga_pll_init(struct device_node *node, + const struct clk_ops *ops) { u32 reg; struct clk_hw *hw_clk; @@ -80,13 +80,13 @@ static __init struct clk_hw *__socfpga_pll_init(struct = device_node *node, const char *parent_name[SOCFPGA_MAX_PARENTS]; struct clk_init_data init; struct device_node *clkmgr_np; - int err; + int rc; =20 of_property_read_u32(node, "reg", ®); =20 pll_clk =3D kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (WARN_ON(!pll_clk)) - return NULL; + return; =20 clkmgr_np =3D of_find_compatible_node(NULL, NULL, "altr,clk-mgr"); clk_mgr_base_addr =3D of_iomap(clkmgr_np, 0); @@ -108,13 +108,25 @@ static __init struct clk_hw *__socfpga_pll_init(struc= t device_node *node, =20 hw_clk =3D &pll_clk->hw.hw; =20 - err =3D clk_hw_register(NULL, hw_clk); - if (err) { - kfree(pll_clk); - return ERR_PTR(err); + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - return hw_clk; + + rc =3D 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_of_clk_add_hw_provider; + } + + return; + +err_of_clk_add_hw_provider: + clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(pll_clk); } =20 void __init socfpga_pll_init(struct device_node *node) --=20 2.38.1 From nobody Thu Sep 18 05:40:33 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09EEDC04FDE for ; Fri, 9 Dec 2022 15:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230216AbiLIPab (ORCPT ); Fri, 9 Dec 2022 10:30:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbiLIPa0 (ORCPT ); Fri, 9 Dec 2022 10:30:26 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8986E1E3C8 for ; Fri, 9 Dec 2022 07:29:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670599771; 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=iLUYz9gKiHY3ndA68I5cW74nts6kf3HnnSAI7CDyETY=; b=dYIQ3XzWmwC+AzjFzcO3lS9fD1YTx5k63ME7n5BVhRpcQdiZfrnA6SVcaRvEC2upUyu1Z/ oIOsQm+eq+WIbzkCmwV9yRJjIa/q8oZklz4MfgkD8Gekrw8yeGy/izC2EjLOPzXZlKnwEd 3tct3b1EWrLf9XQuGo4Q4pJkmc49Itc= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-185-YveCQ8BnOKWSlsd-qdT_gA-1; Fri, 09 Dec 2022 10:29:30 -0500 X-MC-Unique: YveCQ8BnOKWSlsd-qdT_gA-1 Received: by mail-vs1-f71.google.com with SMTP id 190-20020a6719c7000000b003aa14ac75f5so1321656vsz.1 for ; Fri, 09 Dec 2022 07:29:30 -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=iLUYz9gKiHY3ndA68I5cW74nts6kf3HnnSAI7CDyETY=; b=ZNcEUNRC1JZVZ6oNEAQmMDsb2geG92PHfoxDZXSwufmpQ/0K+gpWWlxkk1XFbXKHkA rNsLjju88Z7eFj+qxu6wN0EHv2D+APnN5dvC0Fynhep4mYOSUEfoODEmmURRj6r015fP XVYOlqTbsd3nI6kwfK5ztw0Y/pFyClNM6y6FqK+IHbl90Yw19ykcHdSg8djafrtE+72r GwTpShpprc2SnzFs4SmhiQuUHeLlrbEhT6nzaPB+rM2M2sWZCPB0+hl65vEviz0wmIHK CCnT5cs8bNJ5okywZNCz6xIxbrXTUhhqRt6QoojEO0RJMjV/oc8PDAiv/fZ2+E10lu7g I+gA== X-Gm-Message-State: ANoB5pnt9ZOwqaLId+8yYYwNaoj6A2maixc95rArKp+LZROTEascD9kK LgA+zs42/5c25kkdjqtM6SOoOPJkR/BH02bMRxwgsnaelRaAMjm8BtsUKlWwshOhdA04WHnKlHS +1ShF52gX6GkSAPiU0wP7eHg= X-Received: by 2002:a05:6122:2c5:b0:3bd:b78b:102b with SMTP id k5-20020a05612202c500b003bdb78b102bmr3298744vki.5.1670599770344; Fri, 09 Dec 2022 07:29:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+U2uhioAWISnye3Qoub4LCzfeuIPe70H/84a6MC+WFWRbN5P56LHkPbSWwOlcP2wVGqB3Mg== X-Received: by 2002:a05:6122:2c5:b0:3bd:b78b:102b with SMTP id k5-20020a05612202c500b003bdb78b102bmr3298723vki.5.1670599770101; Fri, 09 Dec 2022 07:29:30 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:29:29 -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 6/6] clk: socfpga: arria10: use of_clk_add_hw_provider and improve error handling Date: Fri, 9 Dec 2022 16:29:13 +0100 Message-Id: <20221209152913.1335068-7-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 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 return type of the init function has been changed to void since the return value was not used, and the indentation of the parameters has been aligned to match open parenthesis, as suggested by checkpatch. Signed-off-by: Marco Pagani --- drivers/clk/socfpga/clk-pll-a10.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/clk/socfpga/clk-pll-a10.c b/drivers/clk/socfpga/clk-pl= l-a10.c index bee0f7da5b6e..b028f25c658a 100644 --- a/drivers/clk/socfpga/clk-pll-a10.c +++ b/drivers/clk/socfpga/clk-pll-a10.c @@ -63,8 +63,8 @@ static const struct clk_ops clk_pll_ops =3D { .get_parent =3D clk_pll_get_parent, }; =20 -static struct clk_hw * __init __socfpga_pll_init(struct device_node *node, - const struct clk_ops *ops) +static void __init __socfpga_pll_init(struct device_node *node, + const struct clk_ops *ops) { u32 reg; struct clk_hw *hw_clk; @@ -73,13 +73,14 @@ static struct clk_hw * __init __socfpga_pll_init(struct= device_node *node, const char *parent_name[SOCFGPA_MAX_PARENTS]; struct clk_init_data init; struct device_node *clkmgr_np; + int rc; int i =3D 0; =20 of_property_read_u32(node, "reg", ®); =20 pll_clk =3D kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (WARN_ON(!pll_clk)) - return NULL; + return; =20 clkmgr_np =3D of_find_compatible_node(NULL, NULL, "altr,clk-mgr"); clk_mgr_a10_base_addr =3D of_iomap(clkmgr_np, 0); @@ -103,12 +104,25 @@ static struct clk_hw * __init __socfpga_pll_init(stru= ct device_node *node, pll_clk->hw.bit_idx =3D SOCFPGA_PLL_EXT_ENA; hw_clk =3D &pll_clk->hw.hw; =20 - if (clk_hw_register(NULL, hw_clk)) { - kfree(pll_clk); - return NULL; + rc =3D clk_hw_register(NULL, hw_clk); + if (rc) { + pr_err("Could not register clock:%s\n", clk_name); + goto err_clk_hw_register; } - of_clk_add_provider(node, of_clk_src_simple_get, hw_clk); - return hw_clk; + + rc =3D 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_of_clk_add_hw_provider; + } + + return; + +err_of_clk_add_hw_provider: + clk_hw_unregister(hw_clk); +err_clk_hw_register: + kfree(pll_clk); } =20 void __init socfpga_a10_pll_init(struct device_node *node) --=20 2.38.1