lkml.org 
[lkml]   [2009]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Cleanups for: line length, printk KERN_ argument, stack frame size > 2048 (added a kmalloc/kfree), style/formatting errors, incorrect include files
    On Fri,  9 Oct 2009 14:11:38 -0700 Bruce Beare wrote:

    > ---
    > drivers/staging/comedi/drivers/serial2002.c | 342 +++++++++++---------------
    > 1 files changed, 145 insertions(+), 197 deletions(-)
    >
    > diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
    > index a219679..0232186 100644
    > --- a/drivers/staging/comedi/drivers/serial2002.c
    > +++ b/drivers/staging/comedi/drivers/serial2002.c
    > @@ -413,34 +408,37 @@ static void serial_2002_open(struct comedi_device *dev)
    > int min;
    > int max;
    > };
    > + struct config_data_t {
    > + struct config_t dig_in_config[32];
    > + struct config_t dig_out_config[32];
    > + struct config_t chan_in_config[32];
    > + struct config_t chan_out_config[32];
    > + } *config_data = NULL;
    >
    > - struct config_t dig_in_config[32];
    > - struct config_t dig_out_config[32];
    > - struct config_t chan_in_config[32];
    > - struct config_t chan_out_config[32];
    > int i;
    > + config_data = kmalloc(sizeof(struct config_data_t), GFP_KERNEL);

    what happens when the kmalloc() fails??


    >
    > for (i = 0; i < 32; i++) {
    > - dig_in_config[i].kind = 0;
    > - dig_in_config[i].bits = 0;
    > - dig_in_config[i].min = 0;
    > - dig_in_config[i].max = 0;
    > - dig_out_config[i].kind = 0;
    > - dig_out_config[i].bits = 0;
    > - dig_out_config[i].min = 0;
    > - dig_out_config[i].max = 0;
    > - chan_in_config[i].kind = 0;
    > - chan_in_config[i].bits = 0;
    > - chan_in_config[i].min = 0;
    > - chan_in_config[i].max = 0;
    > - chan_out_config[i].kind = 0;
    > - chan_out_config[i].bits = 0;
    > - chan_out_config[i].min = 0;
    > - chan_out_config[i].max = 0;
    > + config_data->dig_in_config[i].kind = 0;
    > + config_data->dig_in_config[i].bits = 0;
    > + config_data->dig_in_config[i].min = 0;
    > + config_data->dig_in_config[i].max = 0;
    > + config_data->dig_out_config[i].kind = 0;
    > + config_data->dig_out_config[i].bits = 0;
    > + config_data->dig_out_config[i].min = 0;
    > + config_data->dig_out_config[i].max = 0;
    > + config_data->chan_in_config[i].kind = 0;
    > + config_data->chan_in_config[i].bits = 0;
    > + config_data->chan_in_config[i].min = 0;
    > + config_data->chan_in_config[i].max = 0;
    > + config_data->chan_out_config[i].kind = 0;
    > + config_data->chan_out_config[i].bits = 0;
    > + config_data->chan_out_config[i].min = 0;
    > + config_data->chan_out_config[i].max = 0;
    > }


    ---
    ~Randy


    \
     
     \ /
      Last update: 2009-10-09 23:35    [W:0.027 / U:30.932 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site