From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Inki Dae <inki.dae@samsung.com>, Sasha Levin <sashal@kernel.org>,
sw0312.kim@samsung.com, kyungmin.park@samsung.com,
airlied@gmail.com, daniel@ffwll.ch,
krzysztof.kozlowski@linaro.org, dri-devel@lists.freedesktop.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 16/16] drm/exynos: fix a wrong error checking
Date: Mon, 11 Dec 2023 09:00:40 -0500 [thread overview]
Message-ID: <20231211140116.391986-16-sashal@kernel.org> (raw)
In-Reply-To: <20231211140116.391986-1-sashal@kernel.org>
From: Inki Dae <inki.dae@samsung.com>
[ Upstream commit 8d1b7809684c688005706125b804e1f9792d2b1b ]
Fix a wrong error checking in exynos_drm_dma.c module.
In the exynos_drm_register_dma function, both arm_iommu_create_mapping()
and iommu_get_domain_for_dev() functions are expected to return NULL as
an error.
However, the error checking is performed using the statement
if(IS_ERR(mapping)), which doesn't provide a suitable error value.
So check if 'mapping' is NULL, and if it is, return -ENODEV.
This issue[1] was reported by Dan.
Changelog v1:
- fix build warning.
[1] https://lore.kernel.org/all/33e52277-1349-472b-a55b-ab5c3462bfcf@moroto.mountain/
Reported-by : Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/exynos/exynos_drm_dma.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c
index bf33c3084cb41..6b4d6da3b1f4e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dma.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c
@@ -108,18 +108,16 @@ int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
return 0;
if (!priv->mapping) {
- void *mapping;
+ void *mapping = NULL;
if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
mapping = arm_iommu_create_mapping(&platform_bus_type,
EXYNOS_DEV_ADDR_START, EXYNOS_DEV_ADDR_SIZE);
else if (IS_ENABLED(CONFIG_IOMMU_DMA))
mapping = iommu_get_domain_for_dev(priv->dma_dev);
- else
- mapping = ERR_PTR(-ENODEV);
- if (IS_ERR(mapping))
- return PTR_ERR(mapping);
+ if (!mapping)
+ return -ENODEV;
priv->mapping = mapping;
}
--
2.42.0
prev parent reply other threads:[~2023-12-11 14:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 14:00 [PATCH AUTOSEL 5.10 01/16] ASoC: wm8974: Correct boost mixer inputs Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 02/16] ASoC: Intel: Skylake: Fix mem leak in few functions Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 03/16] ASoC: nau8822: Fix incorrect type in assignment and cast to restricted __be16 Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 04/16] ASoC: Intel: Skylake: mem leak in skl register function Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 05/16] ASoC: cs43130: Fix the position of const qualifier Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 06/16] ASoC: cs43130: Fix incorrect frame delay configuration Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 07/16] ASoC: rt5650: add mutex to avoid the jack detection failure Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 08/16] ASoC: Intel: skl_hda_dsp_generic: Drop HDMI routes when HDMI is not available Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 09/16] nouveau/tu102: flush all pdbs on vmm flush Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 10/16] ASoC: hdac_hda: Conditionally register dais for HDMI and Analog Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 11/16] net/tg3: fix race condition in tg3_reset_task() Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 12/16] ASoC: da7219: Support low DC impedance headset Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 13/16] nvme: introduce helper function to get ctrl state Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 14/16] mips/smp: Call rcutree_report_cpu_starting() earlier Sasha Levin
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 15/16] drm/exynos: fix a potential error pointer dereference Sasha Levin
2023-12-11 14:00 ` Sasha Levin [this message]
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=20231211140116.391986-16-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=krzysztof.kozlowski@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sw0312.kim@samsung.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox