Message ID | 20180828015252.28511-37-robh@kernel.org |
---|---|
State | New |
Headers | show |
Series | nvmem: Convert to using %pOFn instead of device_node.name | expand |
On Mon, Aug 27, 2018 at 8:55 PM Rob Herring <robh@kernel.org> wrote: > > In preparation to remove the node name pointer from struct device_node, > convert printf users to use the %pOFn format specifier. > > Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > Signed-off-by: Rob Herring <robh@kernel.org> > --- > drivers/nvmem/core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Ping. This has no dependencies, so please apply. Rob > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index aa1657831b70..6988ee9f11ba 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -304,6 +304,7 @@ static void nvmem_cell_drop(struct nvmem_cell *cell) > mutex_lock(&nvmem_cells_mutex); > list_del(&cell->node); > mutex_unlock(&nvmem_cells_mutex); > + kfree(cell->name); > kfree(cell); > } > > @@ -879,7 +880,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, > cell->nvmem = nvmem; > cell->offset = be32_to_cpup(addr++); > cell->bytes = be32_to_cpup(addr); > - cell->name = cell_np->name; > + cell->name = kasprintf(GFP_KERNEL, "%pOFn", cell_np); > > addr = of_get_property(cell_np, "bits", &len); > if (addr && len == (2 * sizeof(u32))) { > @@ -904,6 +905,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, > return cell; > > err_sanity: > + kfree(cell->name); > kfree(cell); > > err_mem: > -- > 2.17.1 >
On 28/09/18 23:06, Rob Herring wrote: > On Mon, Aug 27, 2018 at 8:55 PM Rob Herring <robh@kernel.org> wrote: >> >> In preparation to remove the node name pointer from struct device_node, >> convert printf users to use the %pOFn format specifier. >> >> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> >> Signed-off-by: Rob Herring <robh@kernel.org> >> --- >> drivers/nvmem/core.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) > > Ping. This has no dependencies, so please apply. Sorry, Looks like I missed this one! I already re-based it. I will send it with other fixes to Greg KH soon! thanks, --srini > > Rob > >> >> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c >> index aa1657831b70..6988ee9f11ba 100644 >> --- a/drivers/nvmem/core.c >> +++ b/drivers/nvmem/core.c >> @@ -304,6 +304,7 @@ static void nvmem_cell_drop(struct nvmem_cell *cell) >> mutex_lock(&nvmem_cells_mutex); >> list_del(&cell->node); >> mutex_unlock(&nvmem_cells_mutex); >> + kfree(cell->name); >> kfree(cell); >> } >> >> @@ -879,7 +880,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, >> cell->nvmem = nvmem; >> cell->offset = be32_to_cpup(addr++); >> cell->bytes = be32_to_cpup(addr); >> - cell->name = cell_np->name; >> + cell->name = kasprintf(GFP_KERNEL, "%pOFn", cell_np); >> >> addr = of_get_property(cell_np, "bits", &len); >> if (addr && len == (2 * sizeof(u32))) { >> @@ -904,6 +905,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, >> return cell; >> >> err_sanity: >> + kfree(cell->name); >> kfree(cell); >> >> err_mem: >> -- >> 2.17.1 >>
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index aa1657831b70..6988ee9f11ba 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -304,6 +304,7 @@ static void nvmem_cell_drop(struct nvmem_cell *cell) mutex_lock(&nvmem_cells_mutex); list_del(&cell->node); mutex_unlock(&nvmem_cells_mutex); + kfree(cell->name); kfree(cell); } @@ -879,7 +880,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, cell->nvmem = nvmem; cell->offset = be32_to_cpup(addr++); cell->bytes = be32_to_cpup(addr); - cell->name = cell_np->name; + cell->name = kasprintf(GFP_KERNEL, "%pOFn", cell_np); addr = of_get_property(cell_np, "bits", &len); if (addr && len == (2 * sizeof(u32))) { @@ -904,6 +905,7 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, return cell; err_sanity: + kfree(cell->name); kfree(cell); err_mem:
In preparation to remove the node name pointer from struct device_node, convert printf users to use the %pOFn format specifier. Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/nvmem/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1