summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2017-01-09 20:47:44 +0100
committerLinus Walleij <linus.walleij@linaro.org>2017-01-11 16:01:27 +0100
commitfb505747c06b8894bccb18457fd11bad047384f4 (patch)
tree1e97ee70cc956b527c97341dccdccb3a8db18eea /drivers/gpio
parentgpiolib: Update documentation of struct acpi_gpio_info (diff)
downloadlinux-fb505747c06b8894bccb18457fd11bad047384f4.tar.xz
linux-fb505747c06b8894bccb18457fd11bad047384f4.zip
gpio: Remove impossible checks on container_of() result
container_of() does pointer math on the pointer that's passed in. If it were to return a NULL pointer the value passed in would need to be perfectly offset from 0 to make that so. Remove these checks because they don't make sense. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7f51c9bf5533..c76fa4ffb59c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -983,7 +983,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *filp)
struct gpio_device, chrdev);
/* Fail on open if the backing gpiochip is gone */
- if (!gdev || !gdev->chip)
+ if (!gdev->chip)
return -ENODEV;
get_device(&gdev->dev);
filp->private_data = gdev;
@@ -1002,8 +1002,6 @@ static int gpio_chrdev_release(struct inode *inode, struct file *filp)
struct gpio_device *gdev = container_of(inode->i_cdev,
struct gpio_device, chrdev);
- if (!gdev)
- return -ENODEV;
put_device(&gdev->dev);
return 0;
}