From patchwork Mon Mar 6 14:04:56 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: 64703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1868635wrd; Mon, 6 Mar 2023 06:22:32 -0800 (PST) X-Google-Smtp-Source: AK7set/B5tsAUl1u0ybYfrQyTPoRtsiRTvjtJ9R22S5B4YRb0UvgX7q/qXoVNEo/un3zPiaND8S2 X-Received: by 2002:a17:907:8e9a:b0:8f1:da18:c6ca with SMTP id tx26-20020a1709078e9a00b008f1da18c6camr13098538ejc.3.1678112552058; Mon, 06 Mar 2023 06:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678112552; cv=none; d=google.com; s=arc-20160816; b=xNYmoXwMyEixZNGoYZA6yjuSUYC5s6BdlYc/wnfSkgyzczeAEA0j2PzAJoH6oOK7Zu 9RO0bKH6SV835d79FeJrbpZWNtXRcak1Ji2q7Ns+JmJLosGANmicL2MycYJMdQhYjzPR E/RQXNJ9H1F/jQrtH7aak8WcIwN5HcOiwu/+iXuiLqANmvx1F5EF5vOi2zjcxXJ7GAbI eygI8QCYyryJTt1kgysyMK4q2gRBp5RLyUTmcEsawpxGEPk9M5FwnWvozEZDimkNjwZL ZYxz+eq7pDmMy3Hl4MjLKJucX54elAnfMqULGqnR5oAc8xVxTQbn11DFZroDSMnex/3R guEw== 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=iooPnxNCUreiwnxtHYmk6idbQKNNvEUNLwYSBGiCLqo=; b=fJ+kUSJAjvY77wpIvcwb/cqkywB9jNW2JCZwAMweEteuljyxLXXtAZryIhEkRLLmPy 5HvWxV/D//B1QkVWI15f8DHOCrzZv8m94ZFK/RqJLsZn8Wz4LlGv/IZ7h4Ipwu/r/wMX Twu03rL5B/saHO08bAO4t1Q9Q/Wv5tDEa1es4k1tr58jn2Nj12oEsjJU50rgvHkrPW9t ukqYFDlU6BfA2GS75PWA/TJcLAsFhIggvevleaZg5WKFDgjorP9PqjRBjBSfotyyH4r5 2il4HTcpFwihRkDvNelbmQY+8YiRx/KKL6SYw/jQA/8/Mr4pw+Theu/nvDxZh5YYpQAp eW7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="LfI6W/Ep"; 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=QUARANTINE sp=QUARANTINE 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 k9-20020a170906970900b008c56b6c594csi7680272ejx.881.2023.03.06.06.22.08; Mon, 06 Mar 2023 06:22:32 -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="LfI6W/Ep"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbjCFOH2 (ORCPT + 99 others); Mon, 6 Mar 2023 09:07:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbjCFOHM (ORCPT ); Mon, 6 Mar 2023 09:07:12 -0500 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 700BB26855; Mon, 6 Mar 2023 06:06:48 -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 3E3BE6602F5E; Mon, 6 Mar 2023 14:05:58 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1678111559; bh=PZs5wdP/t1w765jNm6To6HjMlHPQzqqkeY9IbGaKLfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfI6W/EpTcejsF1FPepNAzwkvjhg7GEGyGcYs0qST032UOAaKyvT6Kz/B4lqLaQp4 Ap7Fy1HnASx/W03Zz0n/I+10rT9kn4ikfoyCOZRNnwNklkwlDiOAq6YhuEDEm9xmgu FFAxI3E3lu8VX13045lycp99cJ6R/M8/R3ME7xkUk6qwmaCzXW6BiN0iv3W4604HOB 5bEzu+GRyrvz7Ofj/UjzBzU2eJWj4QCEnr8Xmvm8g0RNE1rZkIUKr3ex2eGa/Uv5DL lQr4Nkt/+zBRkOlrer+i9J3AhS6cOHWliRkwR+UfAJGx03ktZWQd9A6aQBphdWSTqx Q9F9sAcNK32BQ== 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, kernel@collabora.com Subject: [PATCH v6 07/54] clk: mediatek: mt2712: Add error handling to clk_mt2712_apmixed_probe() Date: Mon, 6 Mar 2023 15:04:56 +0100 Message-Id: <20230306140543.1813621-8-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306140543.1813621-1-angelogioacchino.delregno@collabora.com> References: <20230306140543.1813621-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?1759628547343254907?= X-GMAIL-MSGID: =?utf-8?q?1759628547343254907?= 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; }