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 <linux@roeck-us.net>
This commit is contained in:
Guenter Roeck
2017-04-26 14:28:27 -07:00
parent 274e450b8a
commit dc13e2af51

18
it87.c
View File

@@ -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);