On 6/10/19 4:33 AM, Jean-Francois Dagenais wrote:
Hi Guenter,

On Jun 7, 2019, at 13:23, Guenter Roeck <[email protected]> wrote:

Declare valid as boolean to match its use case.

Cc: Jean-Francois Dagenais <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
---
v2: No change

drivers/hwmon/max6650.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c
index caede4d3e21a..90565318aafb 100644
--- a/drivers/hwmon/max6650.c
+++ b/drivers/hwmon/max6650.c
@@ -104,7 +104,7 @@ struct max6650_data {
        const struct attribute_group *groups[3];
        struct mutex update_lock;
        int nr_fans;
-       char valid; /* zero until following fields are valid */
+       bool valid; /* false until following fields are valid */

Is there some compiler configuration that ensures this non-explicitely 
initialized function variable will be zero'ed?


struct max6650_data is allocated with devm_kzalloc(), which returns 
zero-cleared data.

Guenter

        unsigned long last_updated; /* in jiffies */

        /* register values */
@@ -183,7 +183,7 @@ static struct max6650_data *max6650_update_device(struct 
device *dev)
                                                        MAX6650_REG_ALARM);

                data->last_updated = jiffies;
-               data->valid = 1;
+               data->valid = true;
        }

        mutex_unlock(&data->update_lock);
--
2.7.4




Reply via email to