[PATCH 35/35] iio: gyro: mpu3050: use default_trigger

From: Jonathan Cameron

Date: Sun Nov 15 2026 - 20:52:30 EST


From: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>

Set indio_dev->default_trigger rather than taking a reference to the
trigger in probe(). The IIO core now takes the reference during
iio_device_register(), so it is not leaked if probe() fails after
the trigger is set up. Whilst the ordering is such that there is
no leak in here today, this will make the ordering less fragile
going forwards.

Signed-off-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
---
drivers/iio/gyro/mpu3050-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 7fbd30068764..954164cefadf 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -1171,7 +1171,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
if (ret)
goto err_iio_trigger;

- indio_dev->trig = iio_trigger_get(mpu3050->trig);
+ indio_dev->default_trigger = mpu3050->trig;

return 0;

--
2.56.1