Skip to contentSkip to conversation

staging: rtl8712: fix coding style error reported from checkpatch

PATCH In review Omri Arad 2 participants 2 messages Sep 12, 2016 Staging

lore
Share & tools
lore

Omri Arad

author
#0 lore raw

PATCH 1/1 staging: rtl8712: fix coding style error reported from checkpatch

removed the following:
ERROR: code indent should use tabs where possible
WARNING: please, no spaces at the start of a line
WARNING: Statements should start on a tabstop

---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -2
index e205adf..475e790 100644
@@ -1976,9 +1976,9 @@ static int r871x_get_ap_info(struct net_device *dev,
 	if (pdata->length >= 32) {
 		if (copy_from_user(data, pdata->pointer, 32))
 			return -EINVAL;
-                data[32] = 0;
+		data[32] = 0;
 	} else {
-		 return -EINVAL;
+		return -EINVAL;
 	}
 	spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
 	phead = &queue->queue;
Signature · 1 line
2.5.0
#1 lore raw

On Mon, 2016-09-12 at 21:02 +0300, Omri Arad wrote:
[]

drivers/staging/rtl8712/rtl871x_ioctl_linux.c

Quoted 1 line
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0

[]

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int r871x_get_ap_info(struct net_device *dev, · line 1984

Quoted 12 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -2
@@ -1976,9 +1976,9 @@ static int r871x_get_ap_info(struct net_device *dev,
  	if (pdata->length >= 32) {
  		if (copy_from_user(data, pdata->pointer, 32))
  			return -EINVAL;
-                data[32] = 0;
+		data[32] = 0;
  	} else {
-		 return -EINVAL;
+		return -EINVAL;
  	}
  	spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
  	phead = &queue->queue;

Please don't blindly follow checkpatch messages but look to see how the code can be improved beyond what checkpatch emits.

Perhaps more pleasant to read would be to rewrite this block like:

	if (pdata->length < 32 ||
	    copy_from_user(data, pdata->pointer, 32))
		return -EINVAL;
	data[32] = 0;

Perhaps as well the literal 32 uses here and the 33 in the declaration of data uses should be some #define or sizeof or ARRAY_SIZE.