.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * PowerNV LED Driver |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * Author: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> |
---|
7 | 8 | * Author: Anshuman Khandual <khandual@linux.vnet.ibm.com> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or |
---|
10 | | - * modify it under the terms of the GNU General Public License |
---|
11 | | - * as published by the Free Software Foundation; either version |
---|
12 | | - * 2 of the License, or (at your option) any later version. |
---|
13 | 9 | */ |
---|
14 | 10 | |
---|
15 | 11 | #include <linux/leds.h> |
---|
.. | .. |
---|
254 | 250 | struct powernv_led_data *powernv_led; |
---|
255 | 251 | struct device *dev = &pdev->dev; |
---|
256 | 252 | |
---|
257 | | - for_each_child_of_node(led_node, np) { |
---|
| 253 | + for_each_available_child_of_node(led_node, np) { |
---|
258 | 254 | p = of_find_property(np, "led-types", NULL); |
---|
259 | 255 | |
---|
260 | 256 | while ((cur = of_prop_next_string(p, cur)) != NULL) { |
---|
.. | .. |
---|
285 | 281 | struct device_node *led_node; |
---|
286 | 282 | struct powernv_led_common *powernv_led_common; |
---|
287 | 283 | struct device *dev = &pdev->dev; |
---|
| 284 | + int rc; |
---|
288 | 285 | |
---|
289 | 286 | led_node = of_find_node_by_path("/ibm,opal/leds"); |
---|
290 | 287 | if (!led_node) { |
---|
.. | .. |
---|
295 | 292 | |
---|
296 | 293 | powernv_led_common = devm_kzalloc(dev, sizeof(*powernv_led_common), |
---|
297 | 294 | GFP_KERNEL); |
---|
298 | | - if (!powernv_led_common) |
---|
299 | | - return -ENOMEM; |
---|
| 295 | + if (!powernv_led_common) { |
---|
| 296 | + rc = -ENOMEM; |
---|
| 297 | + goto out; |
---|
| 298 | + } |
---|
300 | 299 | |
---|
301 | 300 | mutex_init(&powernv_led_common->lock); |
---|
302 | 301 | powernv_led_common->max_led_type = cpu_to_be64(OPAL_SLOT_LED_TYPE_MAX); |
---|
303 | 302 | |
---|
304 | 303 | platform_set_drvdata(pdev, powernv_led_common); |
---|
305 | 304 | |
---|
306 | | - return powernv_led_classdev(pdev, led_node, powernv_led_common); |
---|
| 305 | + rc = powernv_led_classdev(pdev, led_node, powernv_led_common); |
---|
| 306 | +out: |
---|
| 307 | + of_node_put(led_node); |
---|
| 308 | + return rc; |
---|
307 | 309 | } |
---|
308 | 310 | |
---|
309 | 311 | /* Platform driver remove */ |
---|