[media] v4l2-ioctl: fill in name before calling vidioc_g_chip_name
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 6 Apr 2013 09:06:13 +0000 (06:06 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 14 Apr 2013 22:46:49 +0000 (19:46 -0300)
That way drivers do not need to fill in the name themselves for bridge address 0.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/v4l2-core/v4l2-ioctl.c

index 7a96162f544f63625ca764fcf292ff5234f2f752..c48d0acd8bb9c9545cf9d6ae1483ee7533243b1b 100644 (file)
@@ -1869,16 +1869,16 @@ static int v4l_dbg_g_chip_name(const struct v4l2_ioctl_ops *ops,
                        p->flags |= V4L2_CHIP_FL_WRITABLE;
                if (ops->vidioc_g_register)
                        p->flags |= V4L2_CHIP_FL_READABLE;
-               if (ops->vidioc_g_chip_name)
-                       return ops->vidioc_g_chip_name(file, fh, arg);
-               if (p->match.addr)
-                       return -EINVAL;
                if (vfd->v4l2_dev)
                        strlcpy(p->name, vfd->v4l2_dev->name, sizeof(p->name));
                else if (vfd->parent)
                        strlcpy(p->name, vfd->parent->driver->name, sizeof(p->name));
                else
                        strlcpy(p->name, "bridge", sizeof(p->name));
+               if (ops->vidioc_g_chip_name)
+                       return ops->vidioc_g_chip_name(file, fh, arg);
+               if (p->match.addr)
+                       return -EINVAL;
                return 0;
 
        case V4L2_CHIP_MATCH_SUBDEV: