Re: Re: problem in sysfs store function count value and buf not appropriate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 23, 2006 at 08:11:33AM -0800, kanishk rastogi wrote:
> ssize_t max_target_store(struct device_driver * ddp,
>                   const char * buf, size_t count)
> {
>         int data;
> 
>         if (1 != (count=sscanf(buf, "%d", &data))) {
>         return -EINVAL;
>         }
> 		if(data< 1)
> 		{
> 			printk("Targets cant be less than 1");
> 			 return -EINVAL;	
> 		}
>         max_target=data;
>         return count ;
> }

I don't mean to pick on you here, but this is a very good example of how
following the proper kernel coding style can help you out.  If you had
followed it, reading this code would have been trivial for people that
live in the kernel all the time.  This is because their brains get used
to specific patterns and it is easy to pick out the real context of the
code, and not spend extra time trying to wade through { } placement and
spacing issues.

In short, I really don't have any idea what is wrong at first glance,
but I'm probably missing something tiny somewhere.

Try fixing up your coding style, and see if you notice anything wrong
anywhere...  It will give you a good reason to go over your code again.

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux