--- 28p1/drivers/i2c/i2c-proc.c~ 2004-02-18 15:36:31.000000000 +0200 +++ 28p1/drivers/i2c/i2c-proc.c 2004-08-19 15:38:29.000000000 +0300 @@ -198,19 +198,19 @@ void i2c_deregister_entry(int id) { - ctl_table *table; - char *temp; id -= 256; + if (i2c_entries[id]) { - table = i2c_entries[id]->ctl_table; - unregister_sysctl_table(i2c_entries[id]); - /* 2-step kfree needed to keep gcc happy about const points */ - (const char *) temp = table[4].procname; - kfree(temp); - kfree(table); - i2c_entries[id] = NULL; - i2c_clients[id] = NULL; + struct ctl_table_header *hdr = i2c_entries[id]; + struct ctl_table *tbl = hdr->ctl_table; + + unregister_sysctl_table(hdr); + kfree(tbl->child->child->procname); + kfree(tbl); /* actually the whole anonymous struct */ } + + i2c_entries[id] = NULL; + i2c_clients[id] = NULL; } /* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o