From patchwork Tue Jun 6 08:22:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13268711 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68CB5C7EE24 for ; Tue, 6 Jun 2023 08:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235765AbjFFIXn (ORCPT ); Tue, 6 Jun 2023 04:23:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236239AbjFFIXi (ORCPT ); Tue, 6 Jun 2023 04:23:38 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9FC9FA for ; Tue, 6 Jun 2023 01:23:18 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-3f6a6b9c079so48447075e9.1 for ; Tue, 06 Jun 2023 01:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686039788; x=1688631788; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=tqU663avBDGtNA+7qj15+8XcwDxuXpyjVCXFjA4/lfE=; b=Qd5AVRy6jVBxdNVPSb++sWTkyA+QxF3QBQC1QWbDnQIAq5K4gIs1F+pwzH6q3EzBKX lXQ9CakK0PrnhUxg3QcDl66mR5gp3RcFOAYxayLAGEEYQP3++tb6Q3I/FMWj2n4b9T3Z PwihFZgG2GiILNk5IdBq9LuASU2CYN//RPC8PdQGrN6gTQo7DOFrHclOnTObIUZ738CX KtFa4ArHdCzrxK1Akmay5A82wviSo02bldl6jsKC8w19oGVFXdsEPdmv6J9w76lzHyoK wyEOGn/ek+IPbkzD0+v8blH4hjLWlkUqbeciMffzYu3Z99vaY8PgIJ6hljXI9OqhrUfx Qjbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686039788; x=1688631788; 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=tqU663avBDGtNA+7qj15+8XcwDxuXpyjVCXFjA4/lfE=; b=RTY+Rvz8I4sXjJmF1yuowiRw3kkPBPwpSe8L4kMl7nCdoC86DezFqQ6rvs2t/hhm7V gFHHwsncrBkfa9q8vQKrfpHrD1i+dlUzIQEj+lGxbzJbmM3BHmcVHG5BKJA7MbA+nklz pFzLeKEQ16bE7SBUFe4WznXI4iVu19EloIGWjbURnKejKkmv1ynlGpl4frjx9q3K6TCG 8Z972wb+dkP059DkYWhMPqjJrxkOhe4rRt+HjnlvC4GV0lhaejKlIJhDBurCwaYUWEux et0mgdpo/j8DLO6f4HvSYWh8/xBMHWaGclddf9aUgDmU0BD7P4M21iamVTLYIPi54rYv NXew== X-Gm-Message-State: AC+VfDzL3J1Z3jOHA5ES468YOrEDytysLc3069nWNdDrU0ZL8yLB7Ek3 SxbMu6uUh6lJUZA+Ra4k2oQnxSNEbtZ5rDlm8Q8= X-Google-Smtp-Source: ACHHUZ7l32Vj376IpODe04w+e0XBjtDxWNN8qfepBmt6+3to7r/g/Tbpwud1itYVQS0iQk7K1RdT/Q== X-Received: by 2002:a7b:cd97:0:b0:3f4:2973:b8c8 with SMTP id y23-20020a7bcd97000000b003f42973b8c8mr1293139wmj.26.1686039787945; Tue, 06 Jun 2023 01:23:07 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id t14-20020a7bc3ce000000b003f60e143d38sm13144596wmj.11.2023.06.06.01.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 01:23:06 -0700 (PDT) Date: Tue, 6 Jun 2023 11:22:42 +0300 From: Dan Carpenter To: Zhang Rui Cc: "Rafael J. Wysocki" , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] powercap: intel_rapl: Fix a NULL vs IS_ERR() bug Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The devm_ioremap_resource() function returns error pointers on error, it never returns NULL. Update the check accordingly. Fixes: 9eef7f9da928 ("powercap: intel_rapl: Introduce RAPL TPMI interface driver") Signed-off-by: Dan Carpenter Acked-by: Zhang Rui --- drivers/powercap/intel_rapl_tpmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/powercap/intel_rapl_tpmi.c b/drivers/powercap/intel_rapl_tpmi.c index c016127b3497..4f4f13ded225 100644 --- a/drivers/powercap/intel_rapl_tpmi.c +++ b/drivers/powercap/intel_rapl_tpmi.c @@ -255,8 +255,8 @@ static int intel_rapl_tpmi_probe(struct auxiliary_device *auxdev, } trp->base = devm_ioremap_resource(&auxdev->dev, res); - if (!trp->base) { - ret = -ENOMEM; + if (IS_ERR(trp->base)) { + ret = PTR_ERR(trp->base); goto err; }