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) ...@@ -571,12 +571,13 @@ static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
set_fan_speeds(fp); set_fan_speeds(fp);
} }
void bbc_envctrl_init(void) int bbc_envctrl_init(void)
{ {
struct linux_ebus_child *echild; struct linux_ebus_child *echild;
int temp_index = 0; int temp_index = 0;
int fan_index = 0; int fan_index = 0;
int devidx = 0; int devidx = 0;
int err = 0;
while ((echild = bbc_i2c_getdev(devidx++)) != NULL) { while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
if (!strcmp(echild->prom_name, "temperature")) if (!strcmp(echild->prom_name, "temperature"))
...@@ -585,7 +586,8 @@ void bbc_envctrl_init(void) ...@@ -585,7 +586,8 @@ void bbc_envctrl_init(void)
attach_one_fan(echild, fan_index++); attach_one_fan(echild, fan_index++);
} }
if (temp_index != 0 && fan_index != 0) 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) static void destroy_one_temp(struct bbc_cpu_temperature *tp)
......
...@@ -430,14 +430,15 @@ static int __init bbc_present(void) ...@@ -430,14 +430,15 @@ static int __init bbc_present(void)
return 0; return 0;
} }
extern void bbc_envctrl_init(void); extern int bbc_envctrl_init(void);
extern void bbc_envctrl_cleanup(void); extern void bbc_envctrl_cleanup(void);
static void bbc_i2c_cleanup(void);
static int __init bbc_i2c_init(void) static int __init bbc_i2c_init(void)
{ {
struct linux_ebus *ebus = NULL; struct linux_ebus *ebus = NULL;
struct linux_ebus_device *edev = NULL; struct linux_ebus_device *edev = NULL;
int index = 0; int err, index = 0;
if (tlb_type != cheetah || !bbc_present()) if (tlb_type != cheetah || !bbc_present())
return -ENODEV; return -ENODEV;
...@@ -454,11 +455,13 @@ static int __init bbc_i2c_init(void) ...@@ -454,11 +455,13 @@ static int __init bbc_i2c_init(void)
if (!index) if (!index)
return -ENODEV; return -ENODEV;
bbc_envctrl_init(); err = bbc_envctrl_init();
return 0; 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; 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