Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

leds-as3645a: Drop fwnode reference on ignored node

If a node is ignored, do not get a reference to it. Fix the bug by moving
fwnode_handle_get() where a reference to an fwnode is saved for clarity.

Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

authored by

Sakari Ailus and committed by
Pavel
9f4b952d 8e8d699b

+2 -1
+2 -1
drivers/leds/leds-as3645a.c
··· 493 493 switch (id) { 494 494 case AS_LED_FLASH: 495 495 flash->flash_node = child; 496 + fwnode_handle_get(child); 496 497 break; 497 498 case AS_LED_INDICATOR: 498 499 flash->indicator_node = child; 500 + fwnode_handle_get(child); 499 501 break; 500 502 default: 501 503 dev_warn(&flash->client->dev, 502 504 "unknown LED %u encountered, ignoring\n", id); 503 505 break; 504 506 } 505 - fwnode_handle_get(child); 506 507 } 507 508 508 509 if (!flash->flash_node) {