Skip to content

Commit 267ad94

Browse files
claudiubezneabebarino
authored andcommitted
clk: si5341: free unused memory on probe failure
Pointers from synth_clock_names[] should be freed at the end of probe either on probe success or failure path. Fixes: b7bbf6e ("clk: si5341: Allow different output VDD_SEL values") Fixes: 9b13ff4 ("clk: si5341: Add sysfs properties to allow checking/resetting device faults") Signed-off-by: Claudiu Beznea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 36e4ef8 commit 267ad94

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

drivers/clk/clk-si5341.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,7 @@ static int si5341_probe(struct i2c_client *client)
17441744
if (err) {
17451745
dev_err(&client->dev,
17461746
"output %u registration failed\n", i);
1747-
goto cleanup;
1747+
goto free_clk_names;
17481748
}
17491749
if (config[i].always_on)
17501750
clk_prepare(data->clk[i].hw.clk);
@@ -1754,19 +1754,19 @@ static int si5341_probe(struct i2c_client *client)
17541754
data);
17551755
if (err) {
17561756
dev_err(&client->dev, "unable to add clk provider\n");
1757-
goto cleanup;
1757+
goto free_clk_names;
17581758
}
17591759

17601760
if (initialization_required) {
17611761
/* Synchronize */
17621762
regcache_cache_only(data->regmap, false);
17631763
err = regcache_sync(data->regmap);
17641764
if (err < 0)
1765-
goto cleanup;
1765+
goto free_clk_names;
17661766

17671767
err = si5341_finalize_defaults(data);
17681768
if (err < 0)
1769-
goto cleanup;
1769+
goto free_clk_names;
17701770
}
17711771

17721772
/* wait for device to report input clock present and PLL lock */
@@ -1775,21 +1775,19 @@ static int si5341_probe(struct i2c_client *client)
17751775
10000, 250000);
17761776
if (err) {
17771777
dev_err(&client->dev, "Error waiting for input clock or PLL lock\n");
1778-
goto cleanup;
1778+
goto free_clk_names;
17791779
}
17801780

17811781
/* clear sticky alarm bits from initialization */
17821782
err = regmap_write(data->regmap, SI5341_STATUS_STICKY, 0);
17831783
if (err) {
17841784
dev_err(&client->dev, "unable to clear sticky status\n");
1785-
goto cleanup;
1785+
goto free_clk_names;
17861786
}
17871787

17881788
err = sysfs_create_files(&client->dev.kobj, si5341_attributes);
1789-
if (err) {
1789+
if (err)
17901790
dev_err(&client->dev, "unable to create sysfs files\n");
1791-
goto cleanup;
1792-
}
17931791

17941792
free_clk_names:
17951793
/* Free the names, clk framework makes copies */

0 commit comments

Comments
 (0)