From patchwork Mon Feb 20 15:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 59480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1354086wrn; Mon, 20 Feb 2023 07:03:51 -0800 (PST) X-Google-Smtp-Source: AK7set9zfzA2+d9HtR3Ri/dx6rTBXW3zT3ZzLjo03dwjTHdQPZKfkpVzoFF6Kup25GsjHT7Qz5za X-Received: by 2002:a05:6a20:698f:b0:c7:13bf:3fd1 with SMTP id t15-20020a056a20698f00b000c713bf3fd1mr1280100pzk.8.1676905431610; Mon, 20 Feb 2023 07:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676905431; cv=none; d=google.com; s=arc-20160816; b=F+xC+XuwSen6+XWrz69haqW7MnGaAH9yHN7HnYpWF4jLl8p0NLwOMUZfdCHbzGkomd AmP/8QInbyDWCx6J0AqUUzqptXQ+WTGq7TqufQOHPAe1elTy2LH/i8mGixTUIVKE9kzV BSg+YJ+TWRsclFQO91Ny6qqLoZ9UcQOCnsEnJf/WI4Yg2qPO75KWj9/C/zFsbOxzhL5Z DUreKMp+dJ3dDUSnuclHws3PSNAGKJUVyCRL1bxXdk6G5v+mGdgnbzTWX+Z9wDushKKI HQF5cF6NDheM15/I5SzS31tBWd5EPSURtzLzDHREL0lHPl16pUaDQdXC3IlHMwGFc/w4 WoMg== 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=RWgD06ZRhBWQZ50UZ5zihGOiBzCOy4ayqTL+yOR7hH4=; b=xhGE3Y51idDZdJfO2pAZC3Bd7ybk8kkI3jyMzD9Qq+0BiiL5PNqyP2zVvmfZuHgITv ZWEdXKPPjrBUcYiFMgn4PyJ4QgUN1SvzlCel6U9rjx58i/uUFojvgOPW76ZkcF1e/LWN gupVG9OBZp4mkSummA2SLf2WtWzipBQ43iJeb9FdzG113dgE0mZ37BXmcM2fFiDEKUAo bcPaq0qoNNWQvIbL6gfeGhJh6g6CTAvdr74k0eEHzCWVUVWn7fAUTr+iOph3gL8M8GFJ QK2s2qmBUaZvQJqYeQljK5ehysSnD43O4B5Gcjg9kiHA49BDMsqmmallgzWNVtCG255H WbTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CR0Esl4V; 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=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6382c6000000b004fc1fe750fasi14685703pgd.689.2023.02.20.07.03.38; Mon, 20 Feb 2023 07:03:51 -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=@collabora.com header.s=mail header.b=CR0Esl4V; 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=REJECT sp=REJECT dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232323AbjBTPCG (ORCPT + 99 others); Mon, 20 Feb 2023 10:02:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232283AbjBTPBe (ORCPT ); Mon, 20 Feb 2023 10:01:34 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 460831DBA6; Mon, 20 Feb 2023 07:01:27 -0800 (PST) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id DB3E16602172; Mon, 20 Feb 2023 15:01:24 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1676905286; bh=hBKMIaocGmn56Ueun8XDpc5jewvKlJ1Bcnnlk9bLbIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CR0Esl4VpgucDhXdfypjh06yKfjMp3hjCauJmaM0F0/2R76+7Q4JG1QpFusjwNCud rvAXeVZ9l+oj7EjvWElux8A5Kizta0/qjg24LDqZCZJdQ+MORg6vga/Dz6pKR3wZDy HB6hhisykHRPiKrtuY96RLoZq1X4YAF2zrnEoI79raMc1x0toeJwRpS20n71G42urx oUTcwHX4Y42vs2KBK1Hz5f0nCrPTmjR5dWVDfYdBTOhuioIJSue8L7zXkWPvfGH/eU zZka1E0aVh78E/Yuard3xRrDza2YIidAv5YozkPpAMS1vhJZDqcFM62ak32xjfSAbH AO16kmf8iXr1w== From: AngeloGioacchino Del Regno To: mturquette@baylibre.com Cc: sboyd@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, wenst@chromium.org, johnson.wang@mediatek.com, miles.chen@mediatek.com, chun-jie.chen@mediatek.com, daniel@makrotopia.org, fparent@baylibre.com, msp@baylibre.com, nfraprado@collabora.com, rex-bc.chen@mediatek.com, zhaojh329@gmail.com, sam.shih@mediatek.com, edward-jw.yang@mediatek.com, yangyingliang@huawei.com, granquet@baylibre.com, pablo.sun@mediatek.com, sean.wang@mediatek.com, chen.zhong@mediatek.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 07/55] clk: mediatek: mt2712: Add error handling to clk_mt2712_apmixed_probe() Date: Mon, 20 Feb 2023 16:00:23 +0100 Message-Id: <20230220150111.77897-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230220150111.77897-1-angelogioacchino.delregno@collabora.com> References: <20230220150111.77897-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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?1758362790121038703?= X-GMAIL-MSGID: =?utf-8?q?1758362790121038703?= This function was completely missing error handling: add it. Fixes: e2f744a82d72 ("clk: mediatek: Add MT2712 clock support") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Chen-Yu Tsai --- drivers/clk/mediatek/clk-mt2712.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/clk/mediatek/clk-mt2712.c b/drivers/clk/mediatek/clk-mt2712.c index ce28ee47f5cf..8aa361f0fa13 100644 --- a/drivers/clk/mediatek/clk-mt2712.c +++ b/drivers/clk/mediatek/clk-mt2712.c @@ -1091,15 +1091,25 @@ static int clk_mt2712_apmixed_probe(struct platform_device *pdev) struct device_node *node = pdev->dev.of_node; clk_data = mtk_alloc_clk_data(CLK_APMIXED_NR_CLK); + if (!clk_data) + return -ENOMEM; - mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); + r = mtk_clk_register_plls(node, plls, ARRAY_SIZE(plls), clk_data); + if (r) + goto free_clk_data; r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data); + if (r) { + dev_err(&pdev->dev, "Cannot register clock provider: %d\n", r); + goto unregister_plls; + } - if (r != 0) - pr_err("%s(): could not register clock provider: %d\n", - __func__, r); + return 0; +unregister_plls: + mtk_clk_unregister_plls(plls, ARRAY_SIZE(plls), clk_data); +free_clk_data: + mtk_free_clk_data(clk_data); return r; }