mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
gpio: make the iterator point to last handle
When initializing the GPIO handles, we use the iterator (i) to back off if something goes wrong. But since the iterator is also used after we pass the loop, we must decrement by one after exiting the loop so that we point at the last element in the array. Reported-by: Dan Carpenter <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Walter Harms <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
This commit is contained in:
parent
bc0207a546
commit
e2f608be64
1 changed files with 2 additions and 0 deletions
|
|
@ -474,6 +474,8 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
|
|||
dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
|
||||
offset);
|
||||
}
|
||||
/* Let i point at the last handle */
|
||||
i--;
|
||||
lh->numdescs = handlereq.lines;
|
||||
|
||||
fd = anon_inode_getfd("gpio-linehandle",
|
||||
|
|
|
|||
Loading…
Reference in a new issue