Commit 8967454e authored by David S. Miller's avatar David S. Miller

[SPARC64]: Fix probe error handling in bbc_{envctrl,i2c}.c driver.

parent a6cec28d
......@@ -571,12 +571,13 @@ static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
set_fan_speeds(fp);
}
void bbc_envctrl_init(void)
int bbc_envctrl_init(void)
{
struct linux_ebus_child *echild;
int temp_index = 0;
int fan_index = 0;
int devidx = 0;
int err = 0;
while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
if (!strcmp(echild->prom_name, "temperature"))
......@@ -585,7 +586,8 @@ void bbc_envctrl_init(void)
attach_one_fan(echild, fan_index++);
}
if (temp_index != 0 && fan_index != 0)
kernel_thread(kenvctrld, NULL, CLONE_FS | CLONE_FILES);
err = kernel_thread(kenvctrld, NULL, CLONE_FS | CLONE_FILES);
return err;
}
static void destroy_one_temp(struct bbc_cpu_temperature *tp)
......
......@@ -430,14 +430,15 @@ static int __init bbc_present(void)
return 0;
}
extern void bbc_envctrl_init(void);
extern int bbc_envctrl_init(void);
extern void bbc_envctrl_cleanup(void);
static void bbc_i2c_cleanup(void);
static int __init bbc_i2c_init(void)
{
struct linux_ebus *ebus = NULL;
struct linux_ebus_device *edev = NULL;
int index = 0;
int err, index = 0;
if (tlb_type != cheetah || !bbc_present())
return -ENODEV;
......@@ -454,11 +455,13 @@ static int __init bbc_i2c_init(void)
if (!index)
return -ENODEV;
bbc_envctrl_init();
return 0;
err = bbc_envctrl_init();
if (err)
bbc_i2c_cleanup();
return err;
}
static void __exit bbc_i2c_cleanup(void)
static void bbc_i2c_cleanup(void)
{
struct bbc_i2c_bus *bp = all_bbc_i2c;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment