Message ID | cover.1606827507.git.agx@sigxcpu.org |
---|---|
Headers | show |
Series | usb: typec: tps6598x: Export some power supply properties | expand |
On Tue, Dec 1, 2020 at 2:59 PM Guido Günther <agx@sigxcpu.org> wrote: > This allows downstream supplies and userspace to detect > whether external power is supplied. ... > +static int devm_tps6598_psy_register(struct tps6598x *tps) > +{ > + struct power_supply_config psy_cfg = {}; > + const char *port_dev_name = dev_name(tps->dev); > + size_t psy_name_len = strlen(tps6598x_psy_name_prefix) + > + strlen(port_dev_name) + 1; I'm so sorry by not noticing this one... > + char *psy_name; > + > + psy_cfg.drv_data = tps; > + psy_cfg.fwnode = dev_fwnode(tps->dev); > + psy_name = devm_kzalloc(tps->dev, psy_name_len, GFP_KERNEL); > + if (!psy_name) > + return -ENOMEM; > + > + snprintf(psy_name, psy_name_len, "%s%s", tps6598x_psy_name_prefix, > + port_dev_name); ...followed by this. Please, use devm_kasprintf() instead.
Hi Andy, On Tue, Dec 01, 2020 at 03:52:40PM +0200, Andy Shevchenko wrote: > On Tue, Dec 1, 2020 at 2:59 PM Guido Günther <agx@sigxcpu.org> wrote: > > This allows downstream supplies and userspace to detect > > whether external power is supplied. > > ... > > > +static int devm_tps6598_psy_register(struct tps6598x *tps) > > +{ > > + struct power_supply_config psy_cfg = {}; > > + const char *port_dev_name = dev_name(tps->dev); > > > + size_t psy_name_len = strlen(tps6598x_psy_name_prefix) + > > + strlen(port_dev_name) + 1; > > I'm so sorry by not noticing this one... > > > + char *psy_name; > > + > > + psy_cfg.drv_data = tps; > > + psy_cfg.fwnode = dev_fwnode(tps->dev); > > + psy_name = devm_kzalloc(tps->dev, psy_name_len, GFP_KERNEL); > > + if (!psy_name) > > + return -ENOMEM; > > + > > + snprintf(psy_name, psy_name_len, "%s%s", tps6598x_psy_name_prefix, > > + port_dev_name); > > ...followed by this. > > Please, use devm_kasprintf() instead. Will do. I'll let the series sit for a couple of days before sending a v5. Cheers, -- Guido > > -- > With Best Regards, > Andy Shevchenko >