pinctrl: Return -ENOSYS when system call is not available
authorSimon Glass <sjg@chromium.org>
Wed, 24 Mar 2021 21:26:11 +0000 (10:26 +1300)
committerSimon Glass <sjg@chromium.org>
Tue, 6 Apr 2021 04:33:19 +0000 (16:33 +1200)
Update the code to use -ENOSYS, which is the correct error code for an
unimplemented system call in U-Boot.

Also we should not check for a missing operations array as this is not
permitted. For now this can be covered by an assert().

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/pinctrl/pinctrl-uclass.c

index b0f30aa..6e68e52 100644 (file)
@@ -235,8 +235,9 @@ int pinctrl_gpio_request(struct udevice *dev, unsigned offset)
                return ret;
 
        ops = pinctrl_get_ops(pctldev);
-       if (!ops || !ops->gpio_request_enable)
-               return -ENOTSUPP;
+       assert(ops);
+       if (!ops->gpio_request_enable)
+               return -ENOSYS;
 
        return ops->gpio_request_enable(pctldev, pin_selector);
 }
@@ -261,8 +262,9 @@ int pinctrl_gpio_free(struct udevice *dev, unsigned offset)
                return ret;
 
        ops = pinctrl_get_ops(pctldev);
-       if (!ops || !ops->gpio_disable_free)
-               return -ENOTSUPP;
+       assert(ops);
+       if (!ops->gpio_disable_free)
+               return -ENOSYS;
 
        return ops->gpio_disable_free(pctldev, pin_selector);
 }