hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/i2c/muxes/i2c-mux-gpmux.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * General Purpose I2C multiplexer
34 *
45 * Copyright (C) 2017 Axentia Technologies AB
56 *
67 * Author: Peter Rosin <peda@axentia.se>
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/i2c.h>
....@@ -88,18 +85,14 @@
8885 return -ENOMEM;
8986
9087 mux->control = devm_mux_control_get(dev, NULL);
91
- if (IS_ERR(mux->control)) {
92
- if (PTR_ERR(mux->control) != -EPROBE_DEFER)
93
- dev_err(dev, "failed to get control-mux\n");
94
- return PTR_ERR(mux->control);
95
- }
88
+ if (IS_ERR(mux->control))
89
+ return dev_err_probe(dev, PTR_ERR(mux->control),
90
+ "failed to get control-mux\n");
9691
9792 parent = mux_parent_adapter(dev);
98
- if (IS_ERR(parent)) {
99
- if (PTR_ERR(parent) != -EPROBE_DEFER)
100
- dev_err(dev, "failed to get i2c-parent adapter\n");
101
- return PTR_ERR(parent);
102
- }
93
+ if (IS_ERR(parent))
94
+ return dev_err_probe(dev, PTR_ERR(parent),
95
+ "failed to get i2c-parent adapter\n");
10396
10497 children = of_get_child_count(np);
10598
....@@ -120,8 +113,8 @@
120113
121114 ret = of_property_read_u32(child, "reg", &chan);
122115 if (ret < 0) {
123
- dev_err(dev, "no reg property for node '%s'\n",
124
- child->name);
116
+ dev_err(dev, "no reg property for node '%pOFn'\n",
117
+ child);
125118 goto err_children;
126119 }
127120
....@@ -141,6 +134,7 @@
141134 return 0;
142135
143136 err_children:
137
+ of_node_put(child);
144138 i2c_mux_del_adapters(muxc);
145139 err_parent:
146140 i2c_put_adapter(parent);