Show
Ignore:
Timestamp:
04/17/04 19:20:01 (9 years ago)
Author:
khali
Message:

Backport memory allocation reworking from Linux 2.6.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/adm1026.c

    r2349 r2445  
    299299 
    300300struct adm1026_data { 
     301        struct i2c_client client; 
    301302        struct semaphore lock; 
    302303        int sysctl_id; 
     
    638639           But it allows us to access adm1026_{read,write}_value. */ 
    639640 
    640         if (!(new_client = kmalloc((sizeof(struct i2c_client)) + 
    641                                    sizeof(struct adm1026_data), 
    642                                    GFP_KERNEL))) { 
     641        if (!(data = kmalloc(sizeof(struct adm1026_data), GFP_KERNEL))) { 
    643642                err = -ENOMEM; 
    644643                goto ERROR0; 
    645644        } 
    646645 
    647         data = (struct adm1026_data *) (new_client + 1); 
     646        new_client = &data->client; 
    648647        new_client->addr = address; 
    649648        new_client->data = data; 
     
    768767        i2c_detach_client(new_client); 
    769768    ERROR1: 
    770         kfree(new_client); 
     769        kfree(data); 
    771770    ERROR0: 
    772771        return err; 
     
    787786        } 
    788787 
    789         kfree(client); 
     788        kfree(client->data); 
    790789 
    791790        return 0;