[media] rc: ite-cir: Initialise ite_dev::rdev earlier
authorBen Hutchings <ben@decadent.org.uk>
Sun, 19 Aug 2012 22:32:27 +0000 (19:32 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 14 Sep 2012 17:04:16 +0000 (14:04 -0300)
ite_dev::rdev is currently initialised in ite_probe() after
rc_register_device() returns.  If a newly registered device is opened
quickly enough, we may enable interrupts and try to use ite_dev::rdev
before it has been initialised.  Move it up to the earliest point we
can, right after calling rc_allocate_device().

Reported-and-tested-by: YunQiang Su <wzssyqa@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/rc/ite-cir.c

index 36fe5a349b95d34e0d9a2b427b891647bf7bf6fa..24c77a42fc3645c2297688878396ae992ab9dc6b 100644 (file)
@@ -1473,6 +1473,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
        rdev = rc_allocate_device();
        if (!rdev)
                goto failure;
+       itdev->rdev = rdev;
 
        ret = -ENODEV;
 
@@ -1604,7 +1605,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
        if (ret)
                goto failure3;
 
-       itdev->rdev = rdev;
        ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
 
        return 0;