Commit c5cf334d authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

gpio: remove unnecessary checks from gpiod_to_chip()

We don't need to check the gdev pointer in struct gpio_desc - it's
always assigned and never cleared. It's also pointless to check
gdev->chip before we actually serialize access to it.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
parent 6c82e737
...@@ -214,7 +214,7 @@ EXPORT_SYMBOL_GPL(desc_to_gpio); ...@@ -214,7 +214,7 @@ EXPORT_SYMBOL_GPL(desc_to_gpio);
*/ */
struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc) struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
{ {
if (!desc || !desc->gdev) if (!desc)
return NULL; return NULL;
return desc->gdev->chip; return desc->gdev->chip;
} }
...@@ -3505,7 +3505,7 @@ int gpiod_to_irq(const struct gpio_desc *desc) ...@@ -3505,7 +3505,7 @@ int gpiod_to_irq(const struct gpio_desc *desc)
* requires this function to not return zero on an invalid descriptor * requires this function to not return zero on an invalid descriptor
* but rather a negative error number. * but rather a negative error number.
*/ */
if (!desc || IS_ERR(desc) || !desc->gdev || !desc->gdev->chip) if (!desc || IS_ERR(desc))
return -EINVAL; return -EINVAL;
gc = desc->gdev->chip; gc = desc->gdev->chip;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment