Commit fb505747 authored by Stephen Boyd's avatar Stephen Boyd Committed by Linus Walleij

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: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e567c35f
...@@ -983,7 +983,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *filp) ...@@ -983,7 +983,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *filp)
struct gpio_device, chrdev); struct gpio_device, chrdev);
/* Fail on open if the backing gpiochip is gone */ /* Fail on open if the backing gpiochip is gone */
if (!gdev || !gdev->chip) if (!gdev->chip)
return -ENODEV; return -ENODEV;
get_device(&gdev->dev); get_device(&gdev->dev);
filp->private_data = gdev; filp->private_data = gdev;
...@@ -1002,8 +1002,6 @@ static int gpio_chrdev_release(struct inode *inode, struct file *filp) ...@@ -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 *gdev = container_of(inode->i_cdev,
struct gpio_device, chrdev); struct gpio_device, chrdev);
if (!gdev)
return -ENODEV;
put_device(&gdev->dev); put_device(&gdev->dev);
return 0; return 0;
} }
......
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