BACKPORT: leds: leds-gpio: Fix legacy GPIO number case

In the legacy case, led_dat->gpiod is initialized correctly, but
overwritten later by template->gpiod, which is NULL, causing leds-gpio
to fail with:

    gpiod_direction_output: invalid GPIO
    leds-gpio: probe of leds-gpio failed with error -22

Move the initialization of led_dat->gpiod from template->gpiod up, and
always use led_dat->gpiod later, to fix this.

Change-Id: I70486fac1b7b910419f8274e4dd3c0b332aec1af
Fixes: 5c51277a9ababfa4 (leds: leds-gpio: Add support for GPIO descriptors)
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Robert Dolca <robert.dolca@intel.com>
1 file changed