lkml.org 
[lkml]   [2023]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/1] hwmon: remove unnecessary (void*) conversions
From
On 1/11/23 10:29 AM, Guenter Roeck wrote:
> On 1/10/23 18:07, XU pengfei wrote:
>> diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c
>> index f77dc6db31ac..501337ee5aa3 100644
>> --- a/drivers/hwmon/powr1220.c
>> +++ b/drivers/hwmon/powr1220.c
>> @@ -174,7 +174,7 @@ static umode_t
>>   powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
>>               attr, int channel)
>>   {
>> -    struct powr1220_data *chip_data = (struct powr1220_data *)data;
>> +    struct powr1220_data *chip_data = data;

This is wrong. That cast is needed to discard the "const".

CC [M] drivers/hwmon/powr1220.o
drivers/hwmon/powr1220.c: In function ‘powr1220_is_visible’:
drivers/hwmon/powr1220.c:177:43: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
177 | struct powr1220_data *chip_data = data;
| ^~~~
cc1: all warnings being treated as errors

--
Ammar Faizi

\
 
 \ /
  Last update: 2023-03-26 23:36    [W:0.051 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site