iio: hid_sensor_hub: Fix indio_dev->trig assignment
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Fri, 22 Aug 2014 20:48:00 +0000 (21:48 +0100)
committerJonathan Cameron <jic23@kernel.org>
Mon, 25 Aug 2014 20:48:39 +0000 (21:48 +0100)
This can result in wrong reference count for trigger device, call
iio_trigger_get to increment reference.
Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion
with Jonathan.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Stable@vger.kernel.org
drivers/iio/common/hid-sensors/hid-sensor-trigger.c

index a3109a6f4d86569a86d445f8a967fe4b3a4d8cab..92068cdbf8c7a6e1423c889f6de791cc25141071 100644 (file)
@@ -122,7 +122,8 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
                dev_err(&indio_dev->dev, "Trigger Register Failed\n");
                goto error_free_trig;
        }
-       indio_dev->trig = attrb->trigger = trig;
+       attrb->trigger = trig;
+       indio_dev->trig = iio_trigger_get(trig);
 
        return ret;