From dc13e2af5190fbdc2bba16919ce14488f0637c8b Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 26 Apr 2017 14:28:27 -0700 Subject: [PATCH] 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 --- it87.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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); -- 2.39.5