… > - kfree() the buf and *data buffers on the error paths. … Will development interests grow for scope-based resource management? … +++ b/drivers/base/regmap/regmap-kunit.c @@ -145,9 +145,9 @@ static struct regmap *gen_regmap(struct kunit *test, … - struct regmap *ret; + struct regmap *ret = ERR_PTR(-ENOMEM); … How do you think about to use the statement “return ERR_PTR(-ENOMEM);” at the end instead of the extra variable initialisation? … @@ -172,15 +172,17 @@ static struct regmap *gen_regmap(struct kunit *test, *data = kzalloc(sizeof(**data), GFP_KERNEL); if (!(*data)) - return ERR_PTR(-ENOMEM); + goto out_free; … I suggest to reconsider the label selection. Regards, Markus