]> git.sur5r.net Git - groeck-it87/commitdiff
Initialize register pointers before using them
authorGuenter Roeck <linux@roeck-us.net>
Wed, 26 Apr 2017 21:28:27 +0000 (14:28 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 26 Apr 2017 21:28:27 +0000 (14:28 -0700)
Register pointers have to be initialized before they can be used in
it87_check_pwm().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
it87.c

diff --git a/it87.c b/it87.c
index 9eb5370138de2257a9872a3663ca71b27652a08a..f5730bb0b89b66a9b034ab4b3dbb94a524554d07 100644 (file)
--- a/it87.c
+++ b/it87.c
@@ -3329,13 +3329,9 @@ exit:
        return err;
 }
 
-/* Called when we have found a new IT87. */
-static void it87_init_device(struct platform_device *pdev)
+static void it87_init_regs(struct platform_device *pdev)
 {
-       struct it87_sio_data *sio_data = dev_get_platdata(&pdev->dev);
        struct it87_data *data = platform_get_drvdata(pdev);
-       int tmp, i;
-       u8 mask;
 
        /* Initialize chip specific register pointers */
        switch (data->type) {
@@ -3391,6 +3387,15 @@ static void it87_init_device(struct platform_device *pdev)
                data->REG_TEMP_HIGH = IT87_REG_TEMP_HIGH;
                break;
        }
+}
+
+/* Called when we have found a new IT87. */
+static void it87_init_device(struct platform_device *pdev)
+{
+       struct it87_sio_data *sio_data = dev_get_platdata(&pdev->dev);
+       struct it87_data *data = platform_get_drvdata(pdev);
+       int tmp, i;
+       u8 mask;
 
        /*
         * For each PWM channel:
@@ -3632,6 +3637,9 @@ static int it87_probe(struct platform_device *pdev)
 
        mutex_init(&data->update_lock);
 
+       /* Initialize register pointers */
+       it87_init_regs(pdev);
+
        /* Check PWM configuration */
        enable_pwm_interface = it87_check_pwm(dev);