]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/rpmsg/rpmsg_char.c
Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
[linux.git] / drivers / rpmsg / rpmsg_char.c
index eea5ebbb5119a85eb12b1ca550ea93b75ed88c8f..4bbbacdbf3bb7702f185f007b638daf83378d489 100644 (file)
@@ -146,7 +146,6 @@ static int rpmsg_eptdev_release(struct inode *inode, struct file *filp)
 {
        struct rpmsg_eptdev *eptdev = cdev_to_eptdev(inode->i_cdev);
        struct device *dev = &eptdev->dev;
-       struct sk_buff *skb;
 
        /* Close the endpoint, if it's not already destroyed by the parent */
        mutex_lock(&eptdev->ept_lock);
@@ -157,10 +156,7 @@ static int rpmsg_eptdev_release(struct inode *inode, struct file *filp)
        mutex_unlock(&eptdev->ept_lock);
 
        /* Discard all SKBs */
-       while (!skb_queue_empty(&eptdev->queue)) {
-               skb = skb_dequeue(&eptdev->queue);
-               kfree_skb(skb);
-       }
+       skb_queue_purge(&eptdev->queue);
 
        put_device(dev);
 
@@ -227,8 +223,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
        if (!kbuf)
                return -ENOMEM;
 
-       if (!copy_from_iter_full(kbuf, len, from))
-               return -EFAULT;
+       if (!copy_from_iter_full(kbuf, len, from)) {
+               ret = -EFAULT;
+               goto free_kbuf;
+       }
 
        if (mutex_lock_interruptible(&eptdev->ept_lock)) {
                ret = -ERESTARTSYS;
@@ -290,7 +288,7 @@ static const struct file_operations rpmsg_eptdev_fops = {
        .write_iter = rpmsg_eptdev_write_iter,
        .poll = rpmsg_eptdev_poll,
        .unlocked_ioctl = rpmsg_eptdev_ioctl,
-       .compat_ioctl = rpmsg_eptdev_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
 };
 
 static ssize_t name_show(struct device *dev, struct device_attribute *attr,
@@ -451,7 +449,7 @@ static const struct file_operations rpmsg_ctrldev_fops = {
        .open = rpmsg_ctrldev_open,
        .release = rpmsg_ctrldev_release,
        .unlocked_ioctl = rpmsg_ctrldev_ioctl,
-       .compat_ioctl = rpmsg_ctrldev_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
 };
 
 static void rpmsg_ctrldev_release_device(struct device *dev)