Commit e8cb64db authored by Dolev Raviv's avatar Dolev Raviv Committed by Christoph Hellwig

scsi: ufs: fix static checker warning in ufshcd_parse_clock_info

This patch fixes newly introduced static checker warning in
ufshcd_parse_clock_info, introduced by UFS power management series.

Warning:
drivers/scsi/ufs/ufshcd-pltfrm.c:138 ufshcd_parse_clock_info()
warn: passing devm_ allocated variable to kfree. 'clkfreq'

To fix it we remove the kfree(clkfreq) statement.
In addition we removed the redundant goto label.
Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
Reviewed-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent eda910e4
...@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) ...@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq), clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq),
GFP_KERNEL); GFP_KERNEL);
if (!clkfreq) { if (!clkfreq) {
dev_err(dev, "%s: no memory\n", "freq-table-hz");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) ...@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
if (ret && (ret != -EINVAL)) { if (ret && (ret != -EINVAL)) {
dev_err(dev, "%s: error reading array %d\n", dev_err(dev, "%s: error reading array %d\n",
"freq-table-hz", ret); "freq-table-hz", ret);
goto free_clkfreq; return ret;
} }
for (i = 0; i < sz; i += 2) { for (i = 0; i < sz; i += 2) {
ret = of_property_read_string_index(np, ret = of_property_read_string_index(np,
"clock-names", i/2, (const char **)&name); "clock-names", i/2, (const char **)&name);
if (ret) if (ret)
goto free_clkfreq; goto out;
clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL); clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL);
if (!clki) { if (!clki) {
ret = -ENOMEM; ret = -ENOMEM;
goto free_clkfreq; goto out;
} }
clki->min_freq = clkfreq[i]; clki->min_freq = clkfreq[i];
...@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) ...@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
clki->min_freq, clki->max_freq, clki->name); clki->min_freq, clki->max_freq, clki->name);
list_add_tail(&clki->list, &hba->clk_list_head); list_add_tail(&clki->list, &hba->clk_list_head);
} }
free_clkfreq:
kfree(clkfreq);
out: out:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment