mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Bruce B <bbeare1@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Bill Pemberton <wfp5p@virginia.edu>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Cleanups for: line length, printk KERN_ argument, stack frame size > 2048 (added a kmalloc/kfree), style/formatting errors, incorrect include files
Date: Fri, 9 Oct 2009 14:31:24 -0700	[thread overview]
Message-ID: <20091009143124.72ce7f20.randy.dunlap@oracle.com> (raw)
In-Reply-To: <D0384E25-2A85-442D-95C5-115A12514110@gmail.com>

On Fri, 9 Oct 2009 14:29:19 -0700 Bruce B wrote:

> 
> On Oct 9, 2009, at 2:23 PM, Randy Dunlap wrote:
> 
> > 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??
> 
> Nothing good. The driver ignores the return code in numerous places  
> and the open routine in this case is defined to be a void return.
> I considered it to be a general cleanup subject for this driver at a  
> later date.

I would say sooner than later.

> >>
> >> 		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

  reply	other threads:[~2009-10-09 21:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-09 21:11 Bruce Beare
2009-10-09 21:16 ` Greg KH
2009-10-09 21:27   ` Randy Dunlap
2009-10-09 21:29     ` Greg KH
2009-10-09 21:41       ` Bruce B
2009-10-09 21:50         ` Greg KH
2009-10-09 21:31   ` Bruce B
2009-10-09 21:55     ` Daniel Walker
2009-10-09 21:23 ` Randy Dunlap
2009-10-09 21:29   ` Bruce B
2009-10-09 21:31     ` Randy Dunlap [this message]
2009-10-09 22:28 ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091009143124.72ce7f20.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=bbeare1@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wfp5p@virginia.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome