Hi Markus Thank you very much, very good suggestion, do I need to re-send a patch to fix this problem, or modify the previous patch and send it again?
Thanks Xiaolei … > +++ b/drivers/base/regmap/regmap-debugfs.c > @@ -582,18 +582,25 @@ void regmap_debugfs_init(struct regmap *map) … > + map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", > devname, name); > I suggest to reconsider the alignment for function call parameters for this > patch. … > + if (!map->debugfs_name) > + kfree(map->debugfs_name); > Such a null pointer check is redundant. > See also: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/ifnullfree.cocci?id=139711f033f636cc78b6aaf7363252241b9698ef#n2 -----Original Message----- From: Markus Elfring <[email protected]> Sent: Wednesday, December 30, 2020 5:49 PM To: Wang, Xiaolei <[email protected]>; [email protected] Cc: [email protected]; David Lechner <[email protected]>; Greg Kroah-Hartman <[email protected]>; Mark Brown <[email protected]>; Rafael J. Wysocki <[email protected]>; Julia Lawall <[email protected]> Subject: Re: [PATCH v3] regmap: debugfs: Fix a memory leak when calling regmap_attach_dev … > +++ b/drivers/base/regmap/regmap-debugfs.c > @@ -582,18 +582,25 @@ void regmap_debugfs_init(struct regmap *map) … > + map->debugfs_name = kasprintf(GFP_KERNEL, "%s-%s", > devname, name); I suggest to reconsider the alignment for function call parameters for this patch. … > + if (!map->debugfs_name) > + kfree(map->debugfs_name); Such a null pointer check is redundant. See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/coccinelle/free/ifnullfree.cocci?id=139711f033f636cc78b6aaf7363252241b9698ef#n2 Regards, Markus

