diff mbox series

[v1,1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one

Message ID 20210401145457.12255-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State New
Headers show
Series [v1,1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one | expand

Commit Message

Andy Shevchenko April 1, 2021, 2:54 p.m. UTC
By unknown reason device name is set with an index casted from int
to unsigned long while at the same time with "%ld" specifier. Both parts
seems wrong to me, thus replace replace explicit casting and wrong specifier
with proper one, i.e. "%u".

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/industrialio-trigger.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron April 2, 2021, 9:39 a.m. UTC | #1
On Thu,  1 Apr 2021 17:54:56 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> By unknown reason device name is set with an index casted from int
> to unsigned long while at the same time with "%ld" specifier. Both parts
> seems wrong to me, thus replace replace explicit casting and wrong specifier
> with proper one, i.e. "%u".
I'm not going to pretend to know what planet I was on when I wrote this :)

Series applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to poke at.

Thanks,

Jonathan

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/industrialio-trigger.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index 32ac1bec25e3..77fca24147b2 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -75,8 +75,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info,
>  		return trig_info->id;
>  
>  	/* Set the name used for the sysfs directory etc */
> -	dev_set_name(&trig_info->dev, "trigger%ld",
> -		     (unsigned long) trig_info->id);
> +	dev_set_name(&trig_info->dev, "trigger%u", trig_info->id);
>  
>  	ret = device_add(&trig_info->dev);
>  	if (ret)
Andy Shevchenko April 2, 2021, 5:45 p.m. UTC | #2
On Fri, Apr 2, 2021 at 4:25 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Friday, April 2, 2021, Jonathan Cameron <jic23@kernel.org> wrote:
>> On Thu,  1 Apr 2021 17:54:56 +0300
>> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>>
>> > By unknown reason device name is set with an index casted from int
>> > to unsigned long while at the same time with "%ld" specifier. Both parts
>> > seems wrong to me, thus replace replace explicit casting and wrong specifier
>> > with proper one, i.e. "%u".
>> I'm not going to pretend to know what planet I was on when I wrote this :)
>
>
> Actually ā€œ%dā€ is even more correct (aligned with the type), but either will work.

I have noticed a typo in the commit message of the other patch.
I'll send a v2 altogether.

>> Series applied to the togreg branch of iio.git and pushed out as testing
>> for the autobuilders to poke at.
diff mbox series

Patch

diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 32ac1bec25e3..77fca24147b2 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -75,8 +75,7 @@  int __iio_trigger_register(struct iio_trigger *trig_info,
 		return trig_info->id;
 
 	/* Set the name used for the sysfs directory etc */
-	dev_set_name(&trig_info->dev, "trigger%ld",
-		     (unsigned long) trig_info->id);
+	dev_set_name(&trig_info->dev, "trigger%u", trig_info->id);
 
 	ret = device_add(&trig_info->dev);
 	if (ret)