Re: [PATCH 1/2] ASoC: fsl_mqs: move of_node_put() to the correct location

From: Dan Carpenter
Date: Mon Apr 03 2023 - 11:36:46 EST


On Mon, Apr 03, 2023 at 11:26:47PM +0800, Liliang Ye wrote:
> of_node_put() should have been done directly after
> mqs_priv->regmap = syscon_node_to_regmap(gpr_np);
> otherwise it creates a reference leak on the success path.
>
> To fix this, of_node_put() is moved to the correct location, and change
> all the gotos to direct returns.
>
> Fixes: a9d273671440 ("ASoC: fsl_mqs: Fix error handling in probe")
> Signed-off-by: Liliang Ye <yll@xxxxxxxxxxx>
> Reviewed-by: Dan Carpenter <error27@xxxxxxxxx>
> ---

These patches are from a university. I think this patch was based on
manual review rather than static analysis. They have not been tested
and this one affects the success path so that's always extra risky.

However I do believe the patch is correct and reviewed it before it was
sent publically.

regards,
dan carpenter