On Thu, Nov 10, 2022 at 4:30 PM Yang Yingliang <yangyingliang@xxxxxxxxxx> wrote: > > Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's After > bus_id string array"), the name of device is allocated dynamically, > it need be freed in the error path. > > Fixes: 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array") > Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> > --- > drivers/pnp/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c > index 4df5aa6a309c..bb3976566822 100644 > --- a/drivers/pnp/core.c > +++ b/drivers/pnp/core.c > @@ -152,6 +152,7 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, > > dev_id = pnp_add_id(dev, pnpid); > if (!dev_id) { > + kfree_const(dev->dev.kobj.name); Would be better to move the dev_set_name() invocation after this if () unstead. > kfree(dev); > return NULL; > } > --