Skip to content

Commit d774af5

Browse files
topdjgodjamess-huang
authored andcommitted
[Camera] workaround to fix iommu unmap NULL
Change-Id: Id9361faa66dfdeba8688873e8f00224f380804b6 Reviewed-on: https://tp-biosrd-v02/gerrit/85552 Reviewed-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com> Tested-by: Jamess Huang(黃以民) <Jamess_Huang@asus.com>
1 parent 2f499be commit d774af5

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

drivers/iommu/dma-iommu.c

100644100755
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,20 @@ static struct iova *__alloc_iova(struct iova_domain *iovad, size_t size,
168168
/* The IOVA allocator knows what we mapped, so just unmap whatever that was */
169169
static void __iommu_dma_unmap(struct iommu_domain *domain, dma_addr_t dma_addr)
170170
{
171-
struct iova_domain *iovad = domain->iova_cookie;
172-
unsigned long shift = iova_shift(iovad);
173-
unsigned long pfn = dma_addr >> shift;
174-
struct iova *iova = find_iova(iovad, pfn);
171+
struct iova_domain *iovad;
172+
unsigned long shift;
173+
unsigned long pfn;
174+
struct iova *iova;
175175
size_t size;
176176

177+
/* workaround to kill process unmap NULL */
178+
if (domain == NULL)
179+
return;
180+
181+
iovad = domain->iova_cookie;
182+
shift = iova_shift(iovad);
183+
pfn = dma_addr >> shift;
184+
iova = find_iova(iovad, pfn);
177185
if (WARN_ON(!iova))
178186
return;
179187

drivers/media/platform/rockchip/isp1/capture.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,7 +1382,6 @@ static void rkisp1_set_fmt(struct rkisp1_stream *stream,
13821382

13831383
static int rkisp1_dma_attach_device(struct rkisp1_device *rkisp1_dev)
13841384
{
1385-
#if 0 // workaround to avoid iommu unmap NULL
13861385
struct iommu_domain *domain = rkisp1_dev->domain;
13871386
struct device *dev = rkisp1_dev->dev;
13881387
int ret;
@@ -1400,19 +1399,14 @@ static int rkisp1_dma_attach_device(struct rkisp1_device *rkisp1_dev)
14001399
}
14011400

14021401
return ret;
1403-
#else
1404-
return 0;
1405-
#endif
14061402
}
14071403

14081404
static void rkisp1_dma_detach_device(struct rkisp1_device *rkisp1_dev)
14091405
{
1410-
#if 0 // workaround to avoid iommu unmap NULL
14111406
struct iommu_domain *domain = rkisp1_dev->domain;
14121407
struct device *dev = rkisp1_dev->dev;
14131408

14141409
iommu_detach_device(domain, dev);
1415-
#endif
14161410
}
14171411

14181412
static int rkisp1_fh_open(struct file *filp)

0 commit comments

Comments
 (0)