Re: [RFC PATCH 02/06] input/rmi4: Core files

From
devendra.aaru <hidden>
Date
2012-10-06 13:08:58
Also in
lkml
Reply to
devendra.aaru, 2012-10-06
On Sat, Oct 6, 2012 at 9:06 AM, devendra.aaru [off-list ref] wrote:
On Sat, Oct 6, 2012 at 8:19 AM, Joe Perches [off-list ref] wrote:
quoted
On Fri, 2012-10-05 at 21:09 -0700, Christopher Heiny wrote:
[]

Just some trivial comments:
quoted
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
[]
quoted
@@ -0,0 +1,1529 @@
[]
quoted
+static ssize_t delay_write(struct file *filp, const char __user *buffer,
+                        size_t size, loff_t *offset) {
+     struct driver_debugfs_data *data = filp->private_data;
+     struct rmi_device_platform_data *pdata =
+                     data->rmi_dev->phys->dev->platform_data;
+     int retval;
+     char local_buf[size];
+     unsigned int new_read_delay;
+     unsigned int new_write_delay;
+     unsigned int new_block_delay;
+     unsigned int new_pre_delay;
+     unsigned int new_post_delay;
+
+     retval = copy_from_user(local_buf, buffer, size);
+     if (retval)
+             return -EFAULT;
+
+     retval = sscanf(local_buf, "%u %u %u %u %u", &new_read_delay,
+                     &new_write_delay, &new_block_delay,
+                     &new_pre_delay, &new_post_delay);
+     if (retval != 5) {
+             dev_err(&data->rmi_dev->dev,
+                     "Incorrect number of values provided for delay.");
+             return -EINVAL;
+     }
+     if (new_read_delay < 0) {
These are unnecessary tests as unsigned values are never < 0.
Oops, i m sorry, i mistakenly took the variable as int, it should be
unsinged int.

sorry joe, you are right the are never < 0.

 Thanks,
Thread (47 messages) 47 messages, 7 authors, last reply 2012-10-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help