On Wed, Aug 14, 2024 at 06:57:53PM -0300, Jason Gunthorpe wrote: > On Tue, Aug 06, 2024 at 07:11:53PM -0700, Nicolin Chen wrote: > > > +static struct arm_smmu_device * > > +tegra241_cmdqv_probe(struct arm_smmu_device *smmu, > > + struct resource *res, int irq) > > +{ > > + struct tegra241_cmdqv *cmdqv = NULL; > > + struct tegra241_vintf *vintf; > > + void __iomem *base; > > + u32 regval; > > + int lidx; > > + int ret; > > + > > + base = ioremap(res->start, resource_size(res)); > > + if (IS_ERR(base)) { > > + dev_err(smmu->dev, "failed to ioremap: %ld\n", PTR_ERR(base)); > > + goto iounmap; > > + } > > + > > + regval = readl(base + TEGRA241_CMDQV_CONFIG); > > + if (disable_cmdqv) { > > + dev_info(smmu->dev, "Detected disable_cmdqv=true\n"); > > + writel(regval & ~CMDQV_EN, base + TEGRA241_CMDQV_CONFIG); > > + goto iounmap; > > + } > > + > > + cmdqv = devm_krealloc(smmu->dev, smmu, sizeof(*cmdqv), GFP_KERNEL); > > + if (!cmdqv) > > + goto iounmap; > > + smmu = &cmdqv->smmu; > > Should stick a: > > static_assert(offsetof(struct tegra241_cmdqv,smmu) == 0); Done. Thanks! Nicolin > In here. The copy inside the krealloc won't work otherwise. > > But this still seems Ok to me with the new ops > > Jason