On Thu, Jun 4, 2020 at 10:20 AM Dan Carpenter dan.carpenter@oracle.com wrote:
On Thu, Jun 04, 2020 at 09:48:49AM -0400, Jim Quinlan wrote:
r = devm_kcalloc(dev, 1, sizeof(struct dma_pfn_offset_region),
GFP_KERNEL);
Use: r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL);
Will fix.
if (!r)
return -ENOMEM;
r->uniform_offset = true;
r->pfn_offset = pfn_offset;
return 0;
+}
This function doesn't seem to do anything useful. Is part of it missing?
No, the uniform pfn offset is a special case.
Sorry, I wasn't clear. We're talking about different things. The code does:
r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); if (!r) return -ENOMEM; r->uniform_offset = true; r->pfn_offset = pfn_offset; return 0;
The code allocates "r" and then doesn't save it anywhere so there is no point.
You are absolutely right, sorry I missed your point. Will fix.
Thanks, Jim Quinlan
regards, dan carpenter