gpio: of: Fix hard-assigned valid_mask for OF case

The recent refactoring to break out OF code to its own file
contained a bug letting the need_valid_mask
be overridden by the need of the device tree range check,
and if there were no ranges, but device tree was active
and the reserved GPIO used in another way, things likely
crash.

Cc: Mark Brown <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Cc: Stephen Boyd <[email protected]>
Fixes: f626d6dfb709 ("gpio: of: Break out OF-only code")
Reported-by: Mark Brown <[email protected]>
Suggested-by: Stephen Boyd <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
3 files changed