• Guenter Roeck's avatar
    iio: (max1363) Fix probe error path · 678fb42e
    Guenter Roeck authored
    Instantiating the driver with no available regulator results in:
    
    [39711.686393] i2c i2c-7: new_device: Instantiated device max1139 at 0x35
    [39711.688687] BUG: unable to handle kernel paging request at fffffffffffffe13
    [39711.688734] IP: [<ffffffff813e835b>] regulator_disable+0x1b/0x80
    [39711.688788] PGD 1c0e067 PUD 1c0f067 PMD 0
    [39711.688835] Oops: 0000 [#1] SMP
    
    Caused by bad probe error path. Fix it.
    
    Driver should also not attempt to free the interrupt in its error path if
    none was allocated. Fix that problem as well.
    
    Finally, testing if the regulator was allocated is not necessary in the
    remove function, since the probe function bails out if this is the case.
    Remove that check.
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    678fb42e
max1363.c 46.4 KB