From patchwork Wed Sep 4 08:02:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13789925 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 34267CA0ED3 for ; Wed, 4 Sep 2024 08:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dbsiPwHzdU7yQfw0bVfDw6SqwSWkWnRdJycvBly0WUw=; b=PfRDmui54l4Ee1YCBp7+AncwrH VjbCCJjmImuYK18AIPMORJgCC+hgyJf0jrwFx13ZyG3s/eayhqN59BQvT89g9MIcwX86x6SgTJGAm G1idWF7rwLoCfZYWlrl+tcELCq52cPz8K7zb7PpNOurNHquK7b8UcxqzEe5biGo2PFu64HKafYHFg N8GIxXLJDZYPY6asntkNSKY0OlmoiQcZH6CIwGYBAkG7JL+kPHFVewqqJytEnrUHPceqoxrzoUYKK zHxZqL4j4H1wjNhVtfyJEiZEQNrq/AavdJt1GZuxq8jxvZBlbuSi9Cp6+W2qX6vM2QeIr+8yTzfqs TH2oHOGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkzT-00000003JJz-44cJ; Wed, 04 Sep 2024 08:03:47 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slkyX-00000003J3h-02KW for linux-arm-kernel@lists.infradead.org; Wed, 04 Sep 2024 08:02:50 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42c7bc97423so42160665e9.0 for ; Wed, 04 Sep 2024 01:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725436967; x=1726041767; darn=lists.infradead.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=dbsiPwHzdU7yQfw0bVfDw6SqwSWkWnRdJycvBly0WUw=; b=s07dyPjwVdptFAiBKxKHYIqpVBMB6Tzs8cagdeHM51ZoCNBZnVM9qU52s8a8S1UD2S fJHzmkcpqeFFEjbdHFhvUmUmv3BN7jxw2v/AQvQb+CcAmMfmYlojf/zYJp8lAYFELoF1 b3fo06awajeg1ABHg8IAoHkHLsonPHXHwbBp0aQhUj5k33vVqrkxo80wYIf96AbGyGj3 fLUehtFJUoqhnJ077fi49zUPsuxZ55tdeijmy/MKAxV1/DSbGx7AXZeyileDsHbE5wJb +zNCmM3Myga8upWCPmn2QVHRav4QgdfmcfTHyDWXntntbrr2WVpdn1SvI/E0sFNaciD6 8HUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725436967; x=1726041767; 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=dbsiPwHzdU7yQfw0bVfDw6SqwSWkWnRdJycvBly0WUw=; b=bM+I2hqKV45tQfMB6FrMfzWNtWzuJsBWSUnAEJBjQb8BcbFdnPs63aVy/RamE56/Oy bJ7Oj81yGIgUL+GhCGJjuXdvWb/uywPGZE+KRJs6M8/qMCFfR+EFW2S7vG3O6/sBYb1Q 6l1xvD9iNLUFtsfYsmZUUsI+uTiIpHAnWFmzQ2j6qA1xjieA3bspM5U4Mqpv7MU0Jmuk Jl/SA+3GwoJTPOPuIF85DX5q1iPASX3pvRVYGY/R0ZB8Uklfmtuk3d3ANRZJBEOKMuEo CCnhbup2K/6usL7dPUf8fvx0gBAIkjF6nGcgfCvKptXAK80rrjN6+RiMKJpYak2FURbc wxXQ== X-Forwarded-Encrypted: i=1; AJvYcCXqYXc6GdgkHaPa3N/mnFHIYHS52q8Hqkl0peqFtWs/lEFEjjHz2o7G5hh2STpPRr0d4mZh5CHURGEzAcdWJUc1@lists.infradead.org X-Gm-Message-State: AOJu0YwXRmwXMQj8ocL3v3QWj76UmYsStI0r/QRnbv3RDbjJPh8XIgPs 2vy6KxuhWuUQ3Y8cZPYWu80lfhKoQPb7lvCm0j1e9NIhIjTNQYEAzL4JrXYLdcY= X-Google-Smtp-Source: AGHT+IGyDGx5cm2clgCM+58D1DQI6ScWGOORu/UwO/wHkk24NWcrYuEi0RVx30LWqkM6S3wJfZbhMA== X-Received: by 2002:a05:600c:4512:b0:426:5e8e:aa48 with SMTP id 5b1f17b1804b1-42bb01c1ff9mr187146885e9.22.1725436967102; Wed, 04 Sep 2024 01:02:47 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374b9859486sm12993928f8f.111.2024.09.04.01.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 01:02:46 -0700 (PDT) Date: Wed, 4 Sep 2024 11:02:43 +0300 From: Dan Carpenter To: Nate Watterson Cc: Thierry Reding , Krishna Reddy , Will Deacon , Robin Murphy , Joerg Roedel , Jonathan Hunter , Nicolin Chen , Jason Gunthorpe , linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH next] iommu/tegra241-cmdqv: Fix ioremap() error handling in probe() Message-ID: <5a6c1e9a-0724-41b1-86d4-36335d3768ea@stanley.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240904_010249_229896_209E73A8 X-CRM114-Status: GOOD ( 15.04 ) 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 The ioremap() function doesn't return error pointers, it returns NULL on error so update the error handling. Also just return directly instead of calling iounmap() on the NULL pointer. Calling iounmap(NULL) doesn't cause a problem on ARM but on other architectures it can trigger a warning so it'a bad habbit. Fixes: 918eb5c856f6 ("iommu/arm-smmu-v3: Add in-kernel support for NVIDIA Tegra241 (Grace) CMDQV") Signed-off-by: Dan Carpenter Reviewed-by: Nicolin Chen --- drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c index 03fd13c21dcc..240b54192177 100644 --- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c @@ -772,9 +772,9 @@ __tegra241_cmdqv_probe(struct arm_smmu_device *smmu, struct resource *res, static_assert(offsetof(struct tegra241_cmdqv, smmu) == 0); base = ioremap(res->start, resource_size(res)); - if (IS_ERR(base)) { - dev_err(smmu->dev, "failed to ioremap: %ld\n", PTR_ERR(base)); - goto iounmap; + if (!base) { + dev_err(smmu->dev, "failed to ioremap\n"); + return NULL; } regval = readl(base + TEGRA241_CMDQV_CONFIG);