[PATCH 2.4] another gcc-3.4 lvalue fix (i2c-proc)
From: O.Sezer
Date: Thu Aug 19 2004 - 08:08:50 EST
Taken from i2c-2.8.x. Please review and apply to 2.4.28.
This hunk was missed in the patch posted at
http://marc.theaimsgroup.com/?l=linux-kernel&m=109182440417014&w=2 .
Ozkan Sezer
--- 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