linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8712: fix coding style error reported from checkpatch
@ 2016-09-12 18:02 Omri Arad
  2016-09-12 18:14 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Omri Arad @ 2016-09-12 18:02 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel, Greg Kroah-Hartman, devel,
	linux-kernel
  Cc: Omri Arad

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

Signed-off-by: Omri Arad <omriarad3@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index e205adf..475e790 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -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;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: rtl8712: fix coding style error reported from checkpatch
  2016-09-12 18:02 [PATCH] staging: rtl8712: fix coding style error reported from checkpatch Omri Arad
@ 2016-09-12 18:14 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2016-09-12 18:14 UTC (permalink / raw)
  To: Omri Arad, Larry Finger, Florian Schilhabel, Greg Kroah-Hartman,
	devel, linux-kernel

On Mon, 2016-09-12 at 21:02 +0300, Omri Arad wrote:
[]
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
[]
> @@ -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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-12 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 18:02 [PATCH] staging: rtl8712: fix coding style error reported from checkpatch Omri Arad
2016-09-12 18:14 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).