From: Nicolin Chen <nicolinc@nvidia.com> To: <yong.wu@mediatek.com>, <joro@8bytes.org>, <will@kernel.org>, <robin.murphy@arm.com>, <matthias.bgg@gmail.com>, <jean-philippe@linaro.org> Cc: <jgg@nvidia.com>, <kevin.tian@intel.com>, <iommu@lists.linux.dev>, <linux-mediatek@lists.infradead.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <virtualization@lists.linux-foundation.org> Subject: [PATCH v5 6/6] iommu: Propagate return value in ->attach_dev callback functions Date: Thu, 22 Sep 2022 01:54:45 -0700 [thread overview] Message-ID: <8040df414a1d4bc007a25553b8341acf37ead670.1663836372.git.nicolinc@nvidia.com> (raw) In-Reply-To: <cover.1663836372.git.nicolinc@nvidia.com> The mtk_iommu and virtio drivers have places in the ->attach_dev callback functions that return hardcode errnos instead of the returned values, but callers of these ->attach_dv callback functions may care. Propagate them directly without the extra conversions. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> --- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/virtio-iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index be1a7d1cc630..c30dc8f81778 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -666,7 +666,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain, ret = mtk_iommu_domain_finalise(dom, frstdata, region_id); if (ret) { mutex_unlock(&dom->mutex); - return -ENODEV; + return ret; } dom->bank = &data->bank[bankid]; } diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 87128266b6e3..35de7b433b17 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -696,7 +696,7 @@ static int viommu_domain_finalise(struct viommu_endpoint *vdev, if (ret) { ida_free(&viommu->domain_ids, vdomain->id); vdomain->viommu = NULL; - return -EOPNOTSUPP; + return ret; } } -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Nicolin Chen <nicolinc@nvidia.com> To: <yong.wu@mediatek.com>, <joro@8bytes.org>, <will@kernel.org>, <robin.murphy@arm.com>, <matthias.bgg@gmail.com>, <jean-philippe@linaro.org> Cc: <jgg@nvidia.com>, <kevin.tian@intel.com>, <iommu@lists.linux.dev>, <linux-mediatek@lists.infradead.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org>, <virtualization@lists.linux-foundation.org> Subject: [PATCH v5 6/6] iommu: Propagate return value in ->attach_dev callback functions Date: Thu, 22 Sep 2022 01:54:45 -0700 [thread overview] Message-ID: <8040df414a1d4bc007a25553b8341acf37ead670.1663836372.git.nicolinc@nvidia.com> (raw) In-Reply-To: <cover.1663836372.git.nicolinc@nvidia.com> The mtk_iommu and virtio drivers have places in the ->attach_dev callback functions that return hardcode errnos instead of the returned values, but callers of these ->attach_dv callback functions may care. Propagate them directly without the extra conversions. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> --- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/virtio-iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index be1a7d1cc630..c30dc8f81778 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -666,7 +666,7 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain, ret = mtk_iommu_domain_finalise(dom, frstdata, region_id); if (ret) { mutex_unlock(&dom->mutex); - return -ENODEV; + return ret; } dom->bank = &data->bank[bankid]; } diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c index 87128266b6e3..35de7b433b17 100644 --- a/drivers/iommu/virtio-iommu.c +++ b/drivers/iommu/virtio-iommu.c @@ -696,7 +696,7 @@ static int viommu_domain_finalise(struct viommu_endpoint *vdev, if (ret) { ida_free(&viommu->domain_ids, vdomain->id); vdomain->viommu = NULL; - return -EOPNOTSUPP; + return ret; } } -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-09-22 8:55 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-22 8:53 [PATCH v5 0/6] Define EINVAL as device/domain incompatibility Nicolin Chen 2022-09-22 8:53 ` Nicolin Chen 2022-09-22 8:53 ` [PATCH v5 1/6] iommu/msm: Fix error-out routine in msm_iommu_attach_dev() Nicolin Chen 2022-09-22 17:23 ` Jason Gunthorpe 2022-09-22 18:26 ` Nicolin Chen 2022-09-22 8:53 ` [PATCH v5 2/6] iommu/amd: Drop unnecessary checks in amd_iommu_attach_device() Nicolin Chen 2022-09-22 17:23 ` Jason Gunthorpe 2022-09-22 8:54 ` [PATCH v5 3/6] iommu: Add return value rules to attach_dev op and APIs Nicolin Chen 2022-09-22 8:54 ` Nicolin Chen 2022-09-22 17:24 ` Jason Gunthorpe 2022-09-22 17:24 ` Jason Gunthorpe 2022-09-22 8:54 ` [PATCH v5 4/6] iommu: Regulate EINVAL in ->attach_dev callback functions Nicolin Chen 2022-09-22 8:54 ` Nicolin Chen 2022-09-22 17:25 ` Jason Gunthorpe 2022-09-22 17:25 ` Jason Gunthorpe 2022-09-22 8:54 ` [PATCH v5 5/6] iommu: Use EINVAL for incompatible device/domain in ->attach_dev Nicolin Chen 2022-09-22 8:54 ` Nicolin Chen 2022-09-22 17:50 ` Jason Gunthorpe 2022-09-22 17:50 ` Jason Gunthorpe 2022-09-22 8:54 ` Nicolin Chen [this message] 2022-09-22 8:54 ` [PATCH v5 6/6] iommu: Propagate return value in ->attach_dev callback functions Nicolin Chen 2022-09-22 17:51 ` Jason Gunthorpe 2022-09-22 17:51 ` Jason Gunthorpe 2022-09-23 1:09 ` Yong Wu 2022-09-23 1:09 ` Yong Wu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=8040df414a1d4bc007a25553b8341acf37ead670.1663836372.git.nicolinc@nvidia.com \ --to=nicolinc@nvidia.com \ --cc=iommu@lists.linux.dev \ --cc=jean-philippe@linaro.org \ --cc=jgg@nvidia.com \ --cc=joro@8bytes.org \ --cc=kevin.tian@intel.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=matthias.bgg@gmail.com \ --cc=robin.murphy@arm.com \ --cc=virtualization@lists.linux-foundation.org \ --cc=will@kernel.org \ --cc=yong.wu@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.