7
7
* Author: Jacek Anaszewski <[email protected] >
8
8
*/
9
9
10
+ #include <linux/cleanup.h>
10
11
#include <linux/delay.h>
11
12
#include <linux/gpio/consumer.h>
12
13
#include <linux/led-class-flash.h>
@@ -215,7 +216,6 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
215
216
struct device_node * * sub_node )
216
217
{
217
218
struct device * dev = & led -> pdev -> dev ;
218
- struct device_node * child_node ;
219
219
#if IS_ENABLED (CONFIG_V4L2_FLASH_LED_CLASS )
220
220
struct pinctrl * pinctrl ;
221
221
#endif
@@ -246,7 +246,8 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
246
246
}
247
247
#endif
248
248
249
- child_node = of_get_next_available_child (dev_of_node (dev ), NULL );
249
+ struct device_node * child_node __free (device_node ) =
250
+ of_get_next_available_child (dev_of_node (dev ), NULL );
250
251
if (!child_node ) {
251
252
dev_err (dev , "No DT child node found for connected LED.\n" );
252
253
return - EINVAL ;
@@ -267,23 +268,20 @@ static int aat1290_led_parse_dt(struct aat1290_led *led,
267
268
if (ret < 0 ) {
268
269
dev_err (dev ,
269
270
"flash-max-microamp DT property missing\n" );
270
- goto err_parse_dt ;
271
+ return ret ;
271
272
}
272
273
273
274
ret = of_property_read_u32 (child_node , "flash-max-timeout-us" ,
274
275
& cfg -> max_flash_tm );
275
276
if (ret < 0 ) {
276
277
dev_err (dev ,
277
278
"flash-max-timeout-us DT property missing\n" );
278
- goto err_parse_dt ;
279
+ return ret ;
279
280
}
280
281
281
282
* sub_node = child_node ;
282
283
283
- err_parse_dt :
284
- of_node_put (child_node );
285
-
286
- return ret ;
284
+ return 0 ;
287
285
}
288
286
289
287
static void aat1290_led_validate_mm_current (struct aat1290_led * led ,
0 commit comments