From patchwork Mon Oct 30 09:03:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 13440173 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 AABB6C4332F for ; Mon, 30 Oct 2023 09:03:54 +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:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=m+mVxqgA5cDNMaBuWgubpqIwyPvX99gEyMLn8FLhGRI=; b=OY9+2s+hOFMlxH Ja7i3rIRNzo/pl6pcDBulKHwSKBQvrUqVybznruSF1GSs8tubd/7zXjAeWpyboPulksXORBGUshT3 6XEnzY/P66mqgXnMOvYKeo4JUNiJ5wIh1NtCafgMaMEaNsUZMQMZY52xAV8rR5EEkS85hrORyDAaN in+Fs3iPDpcjcZX+6fQrNt0oIarUKyuiN6Y9TTERtoiIQysmSN4aTvm2irbSyH0+gSatwIEgSE8ZE vd5SBaAm7CkWrVnVRMgfBILknmOo9x+AjdJL79PrDjhV9wsI7KG3f9TVOXcdlB7rq/4R9Al3lCYjU tJyompjwZAE9ZBfechfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qxOBB-002sVS-0M; Mon, 30 Oct 2023 09:03:25 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qxOB7-002sU6-31 for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2023 09:03:23 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5079f3f3d7aso6349659e87.1 for ; Mon, 30 Oct 2023 02:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698656598; x=1699261398; 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=cYFH7qp0u3X29NywKpoP1IyU1hw7BcleLqoH2m7DO8E=; b=NF5OQOXoAI94jun28Oxh5ee8K54qKXiEYnJWrnPfO7MZIUovWDc8W2jogFYUvc0lfg Zi+bUd+TC4mm22plQ2/dupKBYQlv7R8Ljgr7nbLDDkliuS/yar/qH3xO/f6FP1vNJpLh mZe+edYIeJNDu4GWVpjvPvV8JplG8D2w/dw2rp0fCXufWhdekNisKfN0lekAvG7Zxvoc jct6Jm0JJQJcNDPl3XqXq9H9QixuDdr+lRA3bB1wcKs7EMEuPNQMZ3qfNXTtIXzQZ6TI 3MSACvfZAH7S6T9O8Jx9ozPHV+dqrLGqhNWMPl8t51qm12jduVoCZz6nguSlK6f5zkXu EoRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698656598; x=1699261398; 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=cYFH7qp0u3X29NywKpoP1IyU1hw7BcleLqoH2m7DO8E=; b=iuugilzc/QAdu+uo+bee4YconhWp0G378DY3DZWRDxV2eQiuocihiKoPrEsx16Xckg OfjjJCg4VqNrEt+ZIYHrU/RnHzIttXAafOofnx5vBWHdSzXItDxkSUbxyxhQ62Li5npe PC2OcN2IwI8CuZvT7Z/frjwWjiax09lyJ8+0j3Lp6zI6fI16GQZNZu1KgnIkSl+KqlOI OtI+viT3z6uEtuBA0UVrd1TihMs8IdMQzvIRXgJ/A0HMZvpzAb+iQZmENk4AAmOgO2QF qj/PJ1PaqrNU29MINctKdALcMrC+ABgqHLP2cze4HjVdOPmbWO4V00aS5PEyoJYtxo1f uYzA== X-Gm-Message-State: AOJu0YwoDcR3nuuMLsxNqGQzhkmwi1nWdHwPMXfb2AflNakzE12KoBlC QWapAWf42wudNZ3QW1nEpypBCw== X-Google-Smtp-Source: AGHT+IEhqt5JyMuDyehB8tfDt0aSGJIzli2DgC7Bp6/VFUQmD21VwzJ1TqPJN1de7TiMAV9dumwFyA== X-Received: by 2002:a05:6512:6d1:b0:507:c7ae:32cc with SMTP id u17-20020a05651206d100b00507c7ae32ccmr8087977lff.41.1698656597789; Mon, 30 Oct 2023 02:03:17 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id s10-20020a05600c45ca00b0040772138bb7sm12176139wmo.2.2023.10.30.02.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:03:17 -0700 (PDT) Date: Mon, 30 Oct 2023 12:03:12 +0300 From: Dan Carpenter To: Jason Gunthorpe Cc: Hector Martin , Sven Peter , Alyssa Rosenzweig , Joerg Roedel , Will Deacon , Robin Murphy , Janne Grunau , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev, kernel-janitors@vger.kernel.org Subject: [PATCH] iommu/dart: Fix return code in apple_dart_domain_alloc_paging() Message-ID: 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-20231030_020321_974562_4C5BE88E X-CRM114-Status: GOOD ( 13.10 ) 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 apple_dart_domain_alloc_paging() function is supposed to return NULL on error. Returning an error pointer will lead to an Oops in __iommu_domain_alloc(). Fixes: 482feb5c6492 ("iommu/dart: Call apple_dart_finalize_domain() as part of alloc_paging()") Signed-off-by: Dan Carpenter Reviewed-by: Jason Gunthorpe --- drivers/iommu/apple-dart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index ee05f4824bfa..cb38a7a826dc 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -761,7 +761,7 @@ static struct iommu_domain *apple_dart_domain_alloc_paging(struct device *dev) ret = apple_dart_finalize_domain(dart_domain, cfg); if (ret) { kfree(dart_domain); - return ERR_PTR(ret); + return NULL; } } return &dart_domain->domain;