Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1da5933 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "camera: smmu: fix for incorrect populated sids"

parents 670817b5 0adab947
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2109,13 +2109,18 @@ static int cam_smmu_populate_sids(struct device *dev,
	struct cam_context_bank_info *cb)
{
	int i, j, rc = 0;
	unsigned int cnt = 0;
	unsigned int cnt = 0, iommu_cells_cnt = 0;
	const void *property;

	/* set the name of the context bank */
	property = of_get_property(dev->of_node, "iommus", &cnt);
	cnt /= 4;
	for (i = 0, j = 0; i < cnt; i = i + 2, j++) {
	rc = of_property_read_u32_index(dev->of_node, "iommu-cells", 0,
		&iommu_cells_cnt);
	if (rc < 0)
		pr_err("invalid iommu-cells count : %d\n", rc);
	iommu_cells_cnt++;
	for (i = 0, j = 0; i < cnt; i = i + iommu_cells_cnt, j++) {
		rc = of_property_read_u32_index(dev->of_node,
			"iommus", i + 1, &cb->sids[j]);
		if (rc < 0)