public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Matthias Beyer <mail@beyermatthias.de>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] drivers: usb: core: devio.c: Coding style fixes
Date: Sat, 12 Oct 2013 19:19:16 +0200	[thread overview]
Message-ID: <52598494.5020108@cogentembedded.com> (raw)
In-Reply-To: <1381575694-9886-1-git-send-email-mail@beyermatthias.de>

Hello.

On 12-10-2013 13:01, Matthias Beyer wrote:

> Whitespace fixes, including:

> - Whitespace after if-keyword
> - Spaces to Tabs

> Other coding style fixes:

> - Added braces for if-else blocks where missing

> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
> ---
>   drivers/usb/core/devio.c | 40 +++++++++++++++++++++-------------------
>   1 file changed, 21 insertions(+), 19 deletions(-)

> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index 71dc5d7..5f8a40d 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
[...]
> @@ -1636,32 +1636,32 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)
>   static int proc_control_compat(struct dev_state *ps,
>   				struct usbdevfs_ctrltransfer32 __user *p32)
>   {
> -        struct usbdevfs_ctrltransfer __user *p;
> -        __u32 udata;
> -        p = compat_alloc_user_space(sizeof(*p));
> -        if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) ||
> -            get_user(udata, &p32->data) ||
> +	struct usbdevfs_ctrltransfer __user *p;
> +	__u32 udata;

    Could you also add an empty line here, for consistency with the below code?

> +	p = compat_alloc_user_space(sizeof(*p));
> +	if (copy_in_user(p, p32, (sizeof(*p32) - sizeof(compat_caddr_t))) ||
> +	    get_user(udata, &p32->data) ||
>   	    put_user(compat_ptr(udata), &p->data))
>   		return -EFAULT;
> -        return proc_control(ps, p);
> +	return proc_control(ps, p);
>   }
>
>   static int proc_bulk_compat(struct dev_state *ps,
>   			struct usbdevfs_bulktransfer32 __user *p32)
>   {
> -        struct usbdevfs_bulktransfer __user *p;
> -        compat_uint_t n;
> -        compat_caddr_t addr;
> +	struct usbdevfs_bulktransfer __user *p;
> +	compat_uint_t n;
> +	compat_caddr_t addr;
>
> -        p = compat_alloc_user_space(sizeof(*p));
> +	p = compat_alloc_user_space(sizeof(*p));
>
> -        if (get_user(n, &p32->ep) || put_user(n, &p->ep) ||
> -            get_user(n, &p32->len) || put_user(n, &p->len) ||
> -            get_user(n, &p32->timeout) || put_user(n, &p->timeout) ||
> -            get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data))
> -                return -EFAULT;
> +	if (get_user(n, &p32->ep) || put_user(n, &p->ep) ||
> +	    get_user(n, &p32->len) || put_user(n, &p->len) ||
> +	    get_user(n, &p32->timeout) || put_user(n, &p->timeout) ||
> +	    get_user(addr, &p32->data) || put_user(compat_ptr(addr), &p->data))
> +		return -EFAULT;
>
> -        return proc_bulk(ps, p);
> +	return proc_bulk(ps, p);
>   }
>   static int proc_disconnectsignal_compat(struct dev_state *ps, void __user *arg)
>   {
> @@ -1838,10 +1838,12 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl)
>   		return -ENODEV;
>   	}
>
> -	if (ps->dev->state != USB_STATE_CONFIGURED)
> +	if (ps->dev->state != USB_STATE_CONFIGURED) {
>   		retval = -EHOSTUNREACH;
> -	else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno)))
> +	}
> +	else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno))) {

    No, } and *else* should be on the same line. But wait, both arms of *if* 
are single statements, so why you added {} in the first place? :-/

>   		retval = -EINVAL;
> +	}

WBR, Sergei


  reply	other threads:[~2013-10-12 16:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-10 21:41 [PATCH 0/6] drivers: usb: core: Adapt source to styleguide Matthias Beyer
2013-10-10 21:41 ` [PATCH 1/6] drivers: usb: core: {file,hub,sysfs,usb}.c: Whitespace fixes Matthias Beyer
2013-10-10 21:41 ` [PATCH 2/6] drivers: usb: core: file.c: moved asterisk to variable name Matthias Beyer
2013-10-10 21:41 ` [PATCH 3/6] drivers: usb: core: hub.c: Comments shouldnt be C99 // comment style Matthias Beyer
2013-10-10 21:41 ` [PATCH 4/6] drivers: usb: core: devio.c: Coding style fixes Matthias Beyer
2013-10-12  0:06   ` Greg KH
2013-10-12 11:01   ` [PATCH 1/1] " Matthias Beyer
2013-10-12 17:19     ` Sergei Shtylyov [this message]
2013-10-14 18:12     ` Greg KH
2013-10-14 19:46       ` [PATCH v2 0/5] " Matthias Beyer
2013-10-14 19:46         ` [PATCH v2 1/5] drivers: usb: core: devio.c: Spaces to tabs for proc_reapurbnonblock() Matthias Beyer
2013-10-14 19:46         ` [PATCH v2 2/5] drivers: usb: core: devio.c: Spaces to tabs for proc_control_compat() Matthias Beyer
2013-10-14 19:46         ` [PATCH v2 3/5] drivers: usb: core: devio.c: Braces around if-elseif-else Matthias Beyer
2013-10-16 20:40           ` Greg KH
2013-10-14 19:46         ` [PATCH v2 4/5] drivers: usb: core: devio.c: Reindented switch-block Matthias Beyer
2013-10-14 19:46         ` [PATCH v2 5/5] drivers: usb: core: devio.c: Put arguments on new line Matthias Beyer
2013-10-16 20:40           ` Greg KH
2013-10-10 21:41 ` [PATCH 5/6] drivers: usb: core: devio.c: Braces around switch Matthias Beyer
2013-10-12  0:08   ` Greg KH
2013-10-12 11:05   ` [PATCH 1/1] drivers: usb: core: devio.c: Braces around switch (updated) Matthias Beyer
2013-10-14 18:12     ` Greg KH
2013-10-10 21:41 ` [PATCH 6/6] drivers: usb: core: devio.c: Else should be on closing braces Matthias Beyer
2013-10-12  0:09 ` [PATCH 0/6] drivers: usb: core: Adapt source to styleguide Greg KH

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=52598494.5020108@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@beyermatthias.de \
    /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