hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/phy/samsung/phy-exynos5250-sata.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Samsung SATA SerDes(PHY) driver
34 *
45 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
56 * Authors: Girish K S <ks.giri@samsung.com>
67 * Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/clk.h>
....@@ -193,6 +190,7 @@
193190 return -EINVAL;
194191
195192 sata_phy->client = of_find_i2c_device_by_node(node);
193
+ of_node_put(node);
196194 if (!sata_phy->client)
197195 return -EPROBE_DEFER;
198196
....@@ -201,20 +199,21 @@
201199 sata_phy->phyclk = devm_clk_get(dev, "sata_phyctrl");
202200 if (IS_ERR(sata_phy->phyclk)) {
203201 dev_err(dev, "failed to get clk for PHY\n");
204
- return PTR_ERR(sata_phy->phyclk);
202
+ ret = PTR_ERR(sata_phy->phyclk);
203
+ goto put_dev;
205204 }
206205
207206 ret = clk_prepare_enable(sata_phy->phyclk);
208207 if (ret < 0) {
209208 dev_err(dev, "failed to enable source clk\n");
210
- return ret;
209
+ goto put_dev;
211210 }
212211
213212 sata_phy->phy = devm_phy_create(dev, NULL, &exynos_sata_phy_ops);
214213 if (IS_ERR(sata_phy->phy)) {
215
- clk_disable_unprepare(sata_phy->phyclk);
216214 dev_err(dev, "failed to create PHY\n");
217
- return PTR_ERR(sata_phy->phy);
215
+ ret = PTR_ERR(sata_phy->phy);
216
+ goto clk_disable;
218217 }
219218
220219 phy_set_drvdata(sata_phy->phy, sata_phy);
....@@ -222,11 +221,18 @@
222221 phy_provider = devm_of_phy_provider_register(dev,
223222 of_phy_simple_xlate);
224223 if (IS_ERR(phy_provider)) {
225
- clk_disable_unprepare(sata_phy->phyclk);
226
- return PTR_ERR(phy_provider);
224
+ ret = PTR_ERR(phy_provider);
225
+ goto clk_disable;
227226 }
228227
229228 return 0;
229
+
230
+clk_disable:
231
+ clk_disable_unprepare(sata_phy->phyclk);
232
+put_dev:
233
+ put_device(&sata_phy->client->dev);
234
+
235
+ return ret;
230236 }
231237
232238 static const struct of_device_id exynos_sata_phy_of_match[] = {
....@@ -240,6 +246,7 @@
240246 .driver = {
241247 .of_match_table = exynos_sata_phy_of_match,
242248 .name = "samsung,sata-phy",
249
+ .suppress_bind_attrs = true,
243250 }
244251 };
245252 module_platform_driver(exynos_sata_phy_driver);