From: Guenter Roeck Date: Wed, 26 Apr 2017 21:28:27 +0000 (-0700) Subject: Initialize register pointers before using them X-Git-Tag: v1.0~26 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dc13e2af5190fbdc2bba16919ce14488f0637c8b;p=groeck-it87 Initialize register pointers before using them Register pointers have to be initialized before they can be used in it87_check_pwm(). Signed-off-by: Guenter Roeck --- diff --git a/it87.c b/it87.c index 9eb5370..f5730bb 100644 --- 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);