Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp348213rdb; Thu, 5 Oct 2023 07:43:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+jvvvNoJF7M7I7Qd1YJXrYsa2BAan8sLKwzuKsP2gN/YhClfbWTXxKKFqxxZNLW9XhUxx X-Received: by 2002:a05:6808:2220:b0:3a9:cfb5:4637 with SMTP id bd32-20020a056808222000b003a9cfb54637mr6430883oib.38.1696517013619; Thu, 05 Oct 2023 07:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696517013; cv=none; d=google.com; s=arc-20160816; b=ue1RGI76ATdzyOqEuka1doRolYDbyKfs08I2CljtTv/1a/jhyAhDKdcI66pI2NMdzT e3iifBwAlfDGq3e77hRe19reGd0TR0S5MUFAPITWf8YVplxXHS197zGsQ+9i2HlO8sKa EFQSAuMz7gUjcDgstilII0Rrc4tvgXe2yi+TmFLAPfOaovpB2ujAWzKOLs/WlR1nIq0I sRyyZSrhNyYMgqmGgFZYSV5NpI6VF55QFWmYsDeL8Jz2y3tCLT4YKHp4WVS/7UEvMflL 2lK4rj/IW7sxACNjl2CsAn90nNjk+bMHRc5VGGDHL4MgKFWS7Q9m1B4j4skSwotW0CtT ammw== 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 Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id z11-20020a6552cb000000b0056da0ae25d1si1514668pgp.831.2023.10.05.07.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:43:33 -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 7492880BF1C4; Thu, 5 Oct 2023 07:43:08 -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 S237621AbjJEOj2 (ORCPT + 99 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-Type: text/plain; charset=us-ascii 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:43:08 -0700 (PDT) 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); -- 2.39.2