diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2010-07-11 16:39:08 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-22 11:38:27 -0700 |
commit | 3c9bbf58b2a7e9099343d36a2c0b206f8c2450df (patch) | |
tree | 19247eebf1b491a86d9c9d64cf123fd70b9dd356 /drivers/staging/iio/accel | |
parent | cb46f472cbb08c44ae47a5bea80207c4e4407ee3 (diff) |
staging: iio: Use kasprintf to allocate and fill trig->name
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/accel')
-rw-r--r-- | drivers/staging/iio/accel/adis16209_trigger.c | 7 | ||||
-rw-r--r-- | drivers/staging/iio/accel/adis16240_trigger.c | 7 | ||||
-rw-r--r-- | drivers/staging/iio/accel/lis3l02dq_ring.c | 8 |
3 files changed, 10 insertions, 12 deletions
diff --git a/drivers/staging/iio/accel/adis16209_trigger.c b/drivers/staging/iio/accel/adis16209_trigger.c index 4a0507c9a13b..cd901a4ca3ff 100644 --- a/drivers/staging/iio/accel/adis16209_trigger.c +++ b/drivers/staging/iio/accel/adis16209_trigger.c @@ -83,14 +83,13 @@ int adis16209_probe_trigger(struct iio_dev *indio_dev) struct adis16209_state *st = indio_dev->dev_data; st->trig = iio_allocate_trigger(); - st->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL); + st->trig->name = kasprintf(GFP_KERNEL, + "adis16209-dev%d", + indio_dev->id); if (!st->trig->name) { ret = -ENOMEM; goto error_free_trig; } - snprintf((char *)st->trig->name, - IIO_TRIGGER_NAME_LENGTH, - "adis16209-dev%d", indio_dev->id); st->trig->dev.parent = &st->us->dev; st->trig->owner = THIS_MODULE; st->trig->private_data = st; diff --git a/drivers/staging/iio/accel/adis16240_trigger.c b/drivers/staging/iio/accel/adis16240_trigger.c index df1312e17f4b..d58b4058688c 100644 --- a/drivers/staging/iio/accel/adis16240_trigger.c +++ b/drivers/staging/iio/accel/adis16240_trigger.c @@ -83,14 +83,13 @@ int adis16240_probe_trigger(struct iio_dev *indio_dev) struct adis16240_state *st = indio_dev->dev_data; st->trig = iio_allocate_trigger(); - st->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL); + st->trig->name = kasprintf(GFP_KERNEL, + "adis16240-dev%d", + indio_dev->id); if (!st->trig->name) { ret = -ENOMEM; goto error_free_trig; } - snprintf((char *)st->trig->name, - IIO_TRIGGER_NAME_LENGTH, - "adis16240-dev%d", indio_dev->id); st->trig->dev.parent = &st->us->dev; st->trig->owner = THIS_MODULE; st->trig->private_data = st; diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c index 6b0b124b11ce..a33599dddddd 100644 --- a/drivers/staging/iio/accel/lis3l02dq_ring.c +++ b/drivers/staging/iio/accel/lis3l02dq_ring.c @@ -495,14 +495,14 @@ int lis3l02dq_probe_trigger(struct iio_dev *indio_dev) if (!state->trig) return -ENOMEM; - state->trig->name = kmalloc(IIO_TRIGGER_NAME_LENGTH, GFP_KERNEL); + state->trig->name = kasprintf(GFP_KERNEL, + "lis3l02dq-dev%d", + indio_dev->id); if (!state->trig->name) { ret = -ENOMEM; goto error_free_trig; } - snprintf((char *)state->trig->name, - IIO_TRIGGER_NAME_LENGTH, - "lis3l02dq-dev%d", indio_dev->id); + state->trig->dev.parent = &state->us->dev; state->trig->owner = THIS_MODULE; state->trig->private_data = state; |