clk: si5341: free unused memory on probe failure
[ Upstream commit 267ad94b13c53d8c99a336f0841b1fa1595b1d0f ] Pointers from synth_clock_names[] should be freed at the end of probe either on probe success or failure path. Fixes: b7bbf6ec4940 ("clk: si5341: Allow different output VDD_SEL values") Fixes: 9b13ff4340df ("clk: si5341: Add sysfs properties to allow checking/resetting device faults") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/20230530093913.1656095-6-claudiu.beznea@microchip.com Signed-off-by: Stephen Boyd <sboyd@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
dc8d0178d5
commit
0b754f9cfd
@ -1732,7 +1732,7 @@ static int si5341_probe(struct i2c_client *client,
|
|||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&client->dev,
|
dev_err(&client->dev,
|
||||||
"output %u registration failed\n", i);
|
"output %u registration failed\n", i);
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
}
|
}
|
||||||
if (config[i].always_on)
|
if (config[i].always_on)
|
||||||
clk_prepare(data->clk[i].hw.clk);
|
clk_prepare(data->clk[i].hw.clk);
|
||||||
@ -1742,7 +1742,7 @@ static int si5341_probe(struct i2c_client *client,
|
|||||||
data);
|
data);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&client->dev, "unable to add clk provider\n");
|
dev_err(&client->dev, "unable to add clk provider\n");
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initialization_required) {
|
if (initialization_required) {
|
||||||
@ -1750,11 +1750,11 @@ static int si5341_probe(struct i2c_client *client,
|
|||||||
regcache_cache_only(data->regmap, false);
|
regcache_cache_only(data->regmap, false);
|
||||||
err = regcache_sync(data->regmap);
|
err = regcache_sync(data->regmap);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
|
|
||||||
err = si5341_finalize_defaults(data);
|
err = si5341_finalize_defaults(data);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wait for device to report input clock present and PLL lock */
|
/* wait for device to report input clock present and PLL lock */
|
||||||
@ -1763,21 +1763,19 @@ static int si5341_probe(struct i2c_client *client,
|
|||||||
10000, 250000);
|
10000, 250000);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&client->dev, "Error waiting for input clock or PLL lock\n");
|
dev_err(&client->dev, "Error waiting for input clock or PLL lock\n");
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear sticky alarm bits from initialization */
|
/* clear sticky alarm bits from initialization */
|
||||||
err = regmap_write(data->regmap, SI5341_STATUS_STICKY, 0);
|
err = regmap_write(data->regmap, SI5341_STATUS_STICKY, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&client->dev, "unable to clear sticky status\n");
|
dev_err(&client->dev, "unable to clear sticky status\n");
|
||||||
goto cleanup;
|
goto free_clk_names;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sysfs_create_files(&client->dev.kobj, si5341_attributes);
|
err = sysfs_create_files(&client->dev.kobj, si5341_attributes);
|
||||||
if (err) {
|
if (err)
|
||||||
dev_err(&client->dev, "unable to create sysfs files\n");
|
dev_err(&client->dev, "unable to create sysfs files\n");
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
free_clk_names:
|
free_clk_names:
|
||||||
/* Free the names, clk framework makes copies */
|
/* Free the names, clk framework makes copies */
|
||||||
|
Loading…
Reference in New Issue
Block a user