From mboxrd@z Thu Jan 1 00:00:00 1970 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 smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 3F9FEC433F5 for ; Mon, 14 Feb 2022 12:49:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DFF0C410AC; Mon, 14 Feb 2022 12:49:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9lCQlKpJAJXz; Mon, 14 Feb 2022 12:49:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id B5FE341061; Mon, 14 Feb 2022 12:49:54 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 96F71C0011; Mon, 14 Feb 2022 12:49:54 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 551E9C000B for ; Mon, 14 Feb 2022 12:49:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3377A4015E for ; Mon, 14 Feb 2022 12:49:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dKRsehjGh0hI for ; Mon, 14 Feb 2022 12:49:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by smtp2.osuosl.org (Postfix) with ESMTPS id 5DDD6400E0 for ; Mon, 14 Feb 2022 12:49:52 +0000 (UTC) Received: by theia.8bytes.org (Postfix, from userid 1000) id C068B2FB; Mon, 14 Feb 2022 13:49:49 +0100 (CET) Date: Mon, 14 Feb 2022 13:49:48 +0100 From: Joerg Roedel To: Lu Baolu Subject: Re: [PATCH v3 07/10] iommu: Use right way to retrieve iommu_ops Message-ID: References: <20220214015538.2828933-1-baolu.lu@linux.intel.com> <20220214015538.2828933-8-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220214015538.2828933-8-baolu.lu@linux.intel.com> Cc: Kevin Tian , Ashok Raj , David Airlie , Robin Murphy , iommu@lists.linux-foundation.org, Jonathan Hunter , Christoph Hellwig , Alex Williamson , Thierry Reding , Ben Skeggs , Jason Gunthorpe , Daniel Vetter , Will Deacon , Christoph Hellwig , linux-kernel@vger.kernel.org, Jacob jun Pan X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Mon, Feb 14, 2022 at 09:55:35AM +0800, Lu Baolu wrote: > +static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) > +{ > + /* > + * Assume that valid ops must be installed if iommu_probe_device() > + * has succeeded. The device ops are essentially for internal use > + * within the IOMMU subsystem itself, so we should be able to trust > + * ourselves not to misuse the helper. > + */ > + WARN_ON(!dev || !dev->iommu || !dev->iommu->iommu_dev || > + !dev->iommu->iommu_dev->ops); There is no need for this WARN_ON, the code will oops anyway when one of the pointers checked here is NULL. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu