From patchwork Thu Oct 5 14:01:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 148761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp346024vqb; Thu, 5 Oct 2023 07:42:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLw+wEVnUFRMZTjx62kGqS23oKsbrA3rtbm+DbiACxn7lHU9M2LmkCOAjtSoewo7f91gTu X-Received: by 2002:a05:6808:319:b0:3a8:7f65:a96 with SMTP id i25-20020a056808031900b003a87f650a96mr5500078oie.33.1696516933219; Thu, 05 Oct 2023 07:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696516933; cv=none; d=google.com; s=arc-20160816; b=ixMS017OJ/gf1DZZo1A4E8sdm9RP5UDqaBG4IRBqqfUKwiuMGgeiukAPeI/rtEZVwW JtQW5bF+j393h7RGHi2+CFty6C4zDbiMVmHlj1NEdyK64Pr73tZYBIY3cv9CKo+sDOct Ug2728nQHxg1uF4NmgfreiXzoObtiS6Y+HdKv7obZOB37MtxC66u7DqPFnpJzoCcPgbB avq5BQjSGwX1W6Uq8f+uxb6i0oBd1ac6gONrZ8rbDmIsNwdkyvVg+azn3KnqUoSf9BYV 4Tmuj/u6gCpE8dq+F5mjhaORgc4XiyVEO2vDoGtX0U8tF+BDCV/1uNmuo9MPeQ/I5KSG WjtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=rbcoAiVjWZW5P7u3ypsUZftXt7DOl7esx6TwnJ6vnvw=; fh=evR83OKmaQCFkiIvs97O1m7Fz9c/dnjKouGYJzbwMpM=; b=mkaG3+UWtwDt5+x48WJyRLGgIohWbxIoqVzLe95kYUBZ4+C9mAZJgqzyGP45RUze5I KvA0qr7SPB04Bz7vycvCE1a8dw83O7wc4EHDOerqCnEn43L4TgkONo/8D7jE+pYYF6UN BAm4BbGFGQgu6L0B0uU5LFffpM+SCQGz2Yzy265tOkuToLd3EXdEYNR59dBC6OuVgWQf Ju5A+UWfExsB+zJYjB4qEy/wiqxgPXD73BxLBkS4EOyEEeCy9E/aswmKvFq/LnfM1rkw fQAcIToVzaLgyNw8ZVHcbPjuEaca84VvkLvHpseuBWHTZcLLlg2kSYcsfWkI374/QZxt YSng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yMXc8n8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id j2-20020a655582000000b00584ca25959csi1568804pgs.540.2023.10.05.07.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:42:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yMXc8n8M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0FF4B80320C5; Thu, 5 Oct 2023 07:41:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237635AbjJEOj2 (ORCPT + 19 others); Thu, 5 Oct 2023 10:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236654AbjJEOgo (ORCPT ); Thu, 5 Oct 2023 10:36:44 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 947F243513 for ; Thu, 5 Oct 2023 07:02:08 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31c5cac3ae2so940345f8f.3 for ; Thu, 05 Oct 2023 07:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696514521; x=1697119321; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=rbcoAiVjWZW5P7u3ypsUZftXt7DOl7esx6TwnJ6vnvw=; b=yMXc8n8Ma24feUaJ3nLJnrS0/sGbDmkbKFvd+GTKldX6HJBvxOtBXW3kOm/33ahOOD /vvpehycvVDywf9zDD6Dkt540SotCRKB8LZq2HmkfAaohkUoFu6vZ8iriL8fY5yDi8zP m69riz4SWRJkH1eGwqwPFbXV9qjwGdlfX2xSzKaCmlIdi1FvKRVFBYH+ZyyiT3WZ/0/S BvXyoBjJf5/dFOmVkrnFDcKPjqHVpeEMlWGeHVx0OJmPQcQPlC7liMOidJLq4FFQvNWa EkZ1H3P+B01GQ0Smwwc0EOF4lDapKHx5WJ6yMtd4/F5TuVek7kOPHIZWxQUAXR9uYAo6 kVDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696514521; x=1697119321; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rbcoAiVjWZW5P7u3ypsUZftXt7DOl7esx6TwnJ6vnvw=; b=tKdN39CubRjfso12GphkcObV9ujWA5HLeYOFenY/atxMqbwIFr+idetbX0scOAH//b +Ots6YINk8yo3r4/G2A5ycTZsPa5QQ0wafOe+ApDt4aPxgCn9CviY7QjzDTY3jl4H1lm HeNHxNRt7cHtS7pD5Hmlh37pltr1ZNsBSUZZYyHWgV96mFpbK+gQzGU2ZNsculA1sLFq oBtKhTMVXCLge+FuoAQYu5Qguiadb/wUPeXxTPDc7LSTyCTuXrVA1ojQwP4NSOSSyX+O 6hUNpVx9DMg30QJFvgFnDOocXqD60bOjzTyy4RcXez1BB9vBEC3beU0Qs7HCp/kxMx85 I59A== X-Gm-Message-State: AOJu0YzAFQvpzD+ZmndtR0HrtIdMbqsb0Ejuu3U+30/s5ARb5UelwR61 T9hgbIgpZ96Oszsp69v7lQHwsw== X-Received: by 2002:adf:f74a:0:b0:31a:d6cb:7f9d with SMTP id z10-20020adff74a000000b0031ad6cb7f9dmr4786129wrp.24.1696514520442; Thu, 05 Oct 2023 07:02:00 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id j18-20020a5d6052000000b003248a490e3asm1867036wrt.39.2023.10.05.07.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:02:00 -0700 (PDT) Date: Thu, 5 Oct 2023 17:01:57 +0300 From: Dan Carpenter To: Santosh Shilimkar Cc: Santosh Shilimkar , Michael Turquette , Stephen Boyd , Mike Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:41:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778926939919978863 X-GMAIL-MSGID: 1778926939919978863 The clk_register_divider() and clk_register_mux() functions returns error pointers on error but this code checks for NULL. Fix that. Fixes: b9e0d40c0d83 ("clk: keystone: add Keystone PLL clock driver") Signed-off-by: Dan Carpenter --- drivers/clk/keystone/pll.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c index ee5c72369334..6bbdd4705d71 100644 --- a/drivers/clk/keystone/pll.c +++ b/drivers/clk/keystone/pll.c @@ -281,12 +281,13 @@ static void __init of_pll_div_clk_init(struct device_node *node) clk = clk_register_divider(NULL, clk_name, parent_name, 0, reg, shift, mask, 0, NULL); - if (clk) { - of_clk_add_provider(node, of_clk_src_simple_get, clk); - } else { + if (IS_ERR(clk)) { pr_err("%s: error registering divider %s\n", __func__, clk_name); iounmap(reg); + return; } + + of_clk_add_provider(node, of_clk_src_simple_get, clk); } CLK_OF_DECLARE(pll_divider_clock, "ti,keystone,pll-divider-clock", of_pll_div_clk_init); @@ -328,10 +329,12 @@ static void __init of_pll_mux_clk_init(struct device_node *node) clk = clk_register_mux(NULL, clk_name, (const char **)&parents, ARRAY_SIZE(parents) , 0, reg, shift, mask, 0, NULL); - if (clk) - of_clk_add_provider(node, of_clk_src_simple_get, clk); - else + if (IS_ERR(clk)) { pr_err("%s: error registering mux %s\n", __func__, clk_name); + return; + } + + of_clk_add_provider(node, of_clk_src_simple_get, clk); } CLK_OF_DECLARE(pll_mux_clock, "ti,keystone,pll-mux-clock", of_pll_mux_clk_init);