Skip to contentSkip to conversation

another gcc-3.4 lvalue fix (i2c-proc)

PATCH New O.Sezer 1 participant 1 message Aug 19, 2004 I2C

lore
Share & tools
lore

O.Sezer

author
#0 lore raw

PATCH 1/1 another gcc-3.4 lvalue fix (i2c-proc)

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

drivers/i2c/i2c-proc.c renamed from drivers/i2c/i2c-proc.c~ +10 -10
@@ -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