Dave Jiang wrote:
> 
> 
> On 9/14/23 00:03, Chen Ni wrote:

[snip]

> > diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
> > index 1b9f5b8a6167..5765674b36f2 100644
> > --- a/drivers/nvdimm/of_pmem.c
> > +++ b/drivers/nvdimm/of_pmem.c
> > @@ -30,7 +30,13 @@ static int of_pmem_region_probe(struct platform_device 
> > *pdev)
> >     if (!priv)
> >             return -ENOMEM;
> >  
> > -   priv->bus_desc.provider_name = kstrdup(pdev->name, GFP_KERNEL);
> > +   priv->bus_desc.provider_name = devm_kstrdup(&pdev->dev, pdev->name,
> > +                                                   GFP_KERNEL);
> > +   if (!priv->bus_desc.provider_name) {
> > +           kfree(priv);
> 
> I wonder if priv should be allocated with devm_kzalloc() instead to reduce 
> the resource management burden. 

I think it could be but this is the driver and I wonder if leaving the
allocation around until the platform device goes away was undesirable for
some reason?

Ira

Reply via email to