From patchwork Thu Aug 15 11:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13764687 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 0F7BDC52D7C for ; Thu, 15 Aug 2024 11:26:03 +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=sJgccsMLKlvTr7kW7rYfi0K+07lJJOFz1A3IB6P2Qqs=; b=gKgkNDYXvP3nkwDse0I9iuo3i1 1BLzF4Rw3UmgspAW8BekFEf8wajh/3CSVhXj7VBDQEztJ1T3JUKxkcFadkZ0jAiZfA7/mnjxdoITk JYhVADabmx3GX3Rzd//YDs2zSErz42PtXSyE300F/mTAtHk70AqGA4RPwJBM/tkZ3wCTl0AyJDXLe Satnh+ysE1LjAmWNY6L4rzsdlv2b3eGWJttwbcmFzaEAbJ0600oQ4w1vO3rX39OGkIZzdN/FoTbB7 emQC/njpm/+dGWslsrU3cK+X7cjJrHwH54a1opqXQxfr7xHBoO2FJ50ourLQ279GHB/sBaM9sqw5c MjeOGKGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seYc2-00000009mFF-2qyS; Thu, 15 Aug 2024 11:25:50 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seYbO-00000009m6v-1mM3 for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 11:25:11 +0000 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5a15692b6f6so1144200a12.0 for ; Thu, 15 Aug 2024 04:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723721108; x=1724325908; 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=sJgccsMLKlvTr7kW7rYfi0K+07lJJOFz1A3IB6P2Qqs=; b=OoW6kI6+8INm5E+mjNeW1+FqKXIZIdZfhEyVCG5Jp06GFjNjrKY33X8VM7lzOBnorY jKtDKBFJxZqkqhsb3Gld4s+fvCGahs3sfd4OgdEscWoAtZQJzAPibn0Guy5Bx4F3z1Qc 1JjgRRkgQEPzIW9ftZxBq+iniw1GyrblDh5Vv6s55ZgktSIbUA4p1GIsUSueEL1RHe8C SWBWgWI/DmT+AUCY3YJRbMzndmvP1DbwQAy31BhDh7HLZUrS7JtinubgG2jXHw654jou HwFvjmWHiVRWevecZBFRQwdZKm9ZtUXiSIPJpq2ItiGjQ0gYKrvkG5E+lE3JQSuK0Jb4 3jTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723721108; x=1724325908; 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=sJgccsMLKlvTr7kW7rYfi0K+07lJJOFz1A3IB6P2Qqs=; b=q041h/zJRNoDnhKsdv5rAs0p4jBCaejngxwwc91+gpI5dwhhrYuUEXk1l4C0h2URPf xKh6FGtnNKCrpxf/bwuqfsfKB9OkLYg0BX3iIuII5F5xlYdTtjvSwvqRRgXhjfbljzdC 9VWQCuCijC2XPVUQYcaIQwc2gc4ZkIcdg/1+BbADl4fey7h5844GnvtBvOQXzMnFQA8Y fup8XEMpuA1Cptg3MxbowngJedcuwwBFIl7uW5ElPia9Neqrb3fGV1L+MaVifNkOtpuo n1cutCoPQF6MmTT390VhPRnQQabxdlPA6CIUAoFDNoiTbHDl6n2yqSyAfzHljBCYjU9x 7rtg== X-Forwarded-Encrypted: i=1; AJvYcCXgZGIpVqloyFizT1SM++oPk+MHzIoEXpboHkeUAWY5bRaQ0n4kY3ZYOc3WWsr0c5vRiEfacHsdQKsPmZA0wISgi/8m29TYunjDScRXLFJsmcep6d0= X-Gm-Message-State: AOJu0Yy2inD7E0LbXPv2CmPE9QpR6JEDd0c7UHseLYujqs51HOFHcmEM 8DWSH87r9NYCCbU4Tr7Dy/imn5h4Ye8CGGBiCPcNos5F1jj0e39r1RphKHZIIB8B2jqTgHp9rEv c X-Google-Smtp-Source: AGHT+IHwCYaVWrDMM/XxSAgRaGSfa25IQdFx+8Hr+PoYjdMN7joZtfNCMY3zxeI7foru5gpy24rJbQ== X-Received: by 2002:a05:6402:3227:b0:5be:bd48:e4ca with SMTP id 4fb4d7f45d1cf-5bebd48e74bmr1231063a12.26.1723721107693; Thu, 15 Aug 2024 04:25:07 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bebbde48fdsm769217a12.28.2024.08.15.04.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 04:25:07 -0700 (PDT) Date: Thu, 15 Aug 2024 14:25:00 +0300 From: Dan Carpenter To: Shameer Kolothum Cc: Will Deacon , Robin Murphy , Joerg Roedel , Jason Gunthorpe , Nicolin Chen , Michael Shavit , Mostafa Saleh , Lu Baolu , Kevin Tian , linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check Message-ID: <9208cd0d-8105-40df-93e9-bdcdf0d55eec@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-20240815_042510_486082_5D957171 X-CRM114-Status: GOOD ( 13.48 ) 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 arm_smmu_domain_alloc() function returns error pointers on error. It doesn't return NULL. Update the error checking to match. Fixes: 52acd7d8a413 ("iommu/arm-smmu-v3: Add support for domain_alloc_user fn") Signed-off-by: Dan Carpenter Reviewed-by: Jason Gunthorpe Reviewed-by: Shameer Kolothum --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index 9bc50bded5af..cf21d7d2e737 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -3062,8 +3062,8 @@ arm_smmu_domain_alloc_user(struct device *dev, u32 flags, return ERR_PTR(-EOPNOTSUPP); smmu_domain = arm_smmu_domain_alloc(); - if (!smmu_domain) - return ERR_PTR(-ENOMEM); + if (IS_ERR(smmu_domain)) + return ERR_CAST(smmu_domain); smmu_domain->domain.type = IOMMU_DOMAIN_UNMANAGED; smmu_domain->domain.ops = arm_smmu_ops.default_domain_ops;