From patchwork Wed Aug 17 10:54:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 12945710 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52024C25B08 for ; Wed, 17 Aug 2022 10:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=04sMZAS2cCya/kWpwFI5gcraeS6Nbl9VLKoYwoiM5o8=; b=vq26MEytbSmHEx ZUGjLWTirptVc83kIqyBKLOzygB68ptmLb9OQk4pik91xEsHG/0F+pXRZL2yI/DuDZv9YX1dRneJR c20Ylw/UoAeeByOuRPo/CQGH19SjX8C09IrunnRzddq6vFzu3++8F0ONg7tX6+ETTga9GYtjtkMa4 CDQfZIhJAZy6FWwfYIJKYCkAfcINZd6/1Es+ZFt+UrI55A5g9M4SsRuvoqCrHlJSf1Mu9UMSarPVo zDR3qFipDdKbi2PRVw2z2QYGOQR2zBzSW4nM4jraMG4ePhFzaO/T2TOmsDoX02E3FQ08RpLJj9NFO 9OEqNWlGxT59426o66Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOGhp-000vbO-7S; Wed, 17 Aug 2022 10:55:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOGhH-000v9r-0m for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2022 10:54:52 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2048D1576; Wed, 17 Aug 2022 03:54:50 -0700 (PDT) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 50EBE3F67D; Wed, 17 Aug 2022 03:54:47 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Cc: sudeep.holla@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, daniel.lezcano@linaro.org, tarek.el-sherbiny@arm.com, adrian.slatineanu@arm.com, souvik.chakravarty@arm.com, wleavitt@marvell.com, wbartczak@marvell.com, dan.carpenter@oracle.com Subject: [PATCH 3/3] powercap: arm_scmi: Fix a NULL vs IS_ERR() bug Date: Wed, 17 Aug 2022 11:54:24 +0100 Message-Id: <20220817105424.3124006-4-cristian.marussi@arm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220817105424.3124006-1-cristian.marussi@arm.com> References: <20220817105424.3124006-1-cristian.marussi@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220817_035451_196727_4000EC11 X-CRM114-Status: GOOD ( 10.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dan Carpenter The powercap_register_control_type() return error pointers. It never returns NULL. Fixes: 31afdd34f2b9 ("powercap: arm_scmi: Add SCMI powercap based driver") Signed-off-by: Dan Carpenter --- drivers/powercap/arm_scmi_powercap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c index dc26cbb32b35..9993b7fa4993 100644 --- a/drivers/powercap/arm_scmi_powercap.c +++ b/drivers/powercap/arm_scmi_powercap.c @@ -521,8 +521,8 @@ static int __init scmi_powercap_init(void) int ret; scmi_top_pcntrl = powercap_register_control_type(NULL, "arm-scmi", NULL); - if (!scmi_top_pcntrl) - return -ENODEV; + if (IS_ERR(scmi_top_pcntrl)) + return PTR_ERR(scmi_top_pcntrl); ret = scmi_register(&scmi_powercap_driver); if (ret)