linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: Daniel Mack <daniel@caiaq.de>
Cc: linux-kernel@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Jiri Slaby <jslaby@suse.cz>, Dmitry Torokhov <dtor@mail.ru>,
	Devin Heitmueller <dheitmueller@kernellabs.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] drivers/media/dvb/dvb-usb/dib0700: fix return values
Date: Wed, 19 May 2010 12:34:48 +0200	[thread overview]
Message-ID: <20100519103448.GH5202@pengutronix.de> (raw)
In-Reply-To: <1274264772-19292-1-git-send-email-daniel@caiaq.de>

[-- Attachment #1: Type: text/plain, Size: 3833 bytes --]

On Wed, May 19, 2010 at 12:26:12PM +0200, Daniel Mack wrote:
> Propagte correct error values instead of returning -1 which just means
> -EPERM ("Permission denied")
> 
> While at it, also fix some coding style violations.
> 
> Signed-off-by: Daniel Mack <daniel@caiaq.de>

Just minor nits. You decide if it is worth a resend ;)

> Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
> Cc: Jiri Slaby <jslaby@suse.cz>
> Cc: Dmitry Torokhov <dtor@mail.ru>
> Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
> Cc: linux-media@vger.kernel.org
> ---
>  drivers/media/dvb/dvb-usb/dib0700_core.c |   47 ++++++++++++++---------------
>  1 files changed, 23 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
> index d5e2c23..c73da6b 100644
> --- a/drivers/media/dvb/dvb-usb/dib0700_core.c
> +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
> @@ -111,23 +111,24 @@ int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_
>  
>  static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets)
>  {
> -    struct dib0700_state *st = d->priv;
> -    u8 b[3];
> -    int ret;
> -
> -    if (st->fw_version >= 0x10201) {
> -	b[0] = REQUEST_SET_USB_XFER_LEN;
> -	b[1] = (nb_ts_packets >> 8)&0xff;
> -	b[2] = nb_ts_packets & 0xff;
> -
> -	deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
> -
> -	ret = dib0700_ctrl_wr(d, b, 3);
> -    } else {
> -	deb_info("this firmware does not allow to change the USB xfer len\n");
> -	ret = -EIO;
> -    }
> -    return ret;
> +	struct dib0700_state *st = d->priv;
> +	u8 b[3];
> +	int ret;
> +
> +	if (st->fw_version >= 0x10201) {
> +		b[0] = REQUEST_SET_USB_XFER_LEN;
> +		b[1] = (nb_ts_packets >> 8)&0xff;

Spaces around operators?

> +		b[2] = nb_ts_packets & 0xff;
> +
> +		deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets);
> +
> +		ret = dib0700_ctrl_wr(d, b, 3);
> +	} else {
> +		deb_info("this firmware does not allow to change the USB xfer len\n");
> +		ret = -EIO;
> +	}
> +
> +	return ret;
>  }
>  
>  /*
> @@ -642,7 +643,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
>  	i = dib0700_ctrl_wr(d, rc_setup, 3);
>  	if (i<0) {

Spaces around operators?

>  		err("ir protocol setup failed");
> -		return -1;
> +		return i;
>  	}
>  
>  	if (st->fw_version < 0x10200)
> @@ -652,7 +653,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
>  	purb = usb_alloc_urb(0, GFP_KERNEL);
>  	if (purb == NULL) {
>  		err("rc usb alloc urb failed\n");
> -		return -1;
> +		return -ENOMEM;
>  	}
>  
>  	purb->transfer_buffer = usb_buffer_alloc(d->udev, RC_MSG_SIZE_V1_20,
> @@ -661,7 +662,7 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
>  	if (purb->transfer_buffer == NULL) {
>  		err("rc usb_buffer_alloc() failed\n");
>  		usb_free_urb(purb);
> -		return -1;
> +		return -ENOMEM;
>  	}
>  
>  	purb->status = -EINPROGRESS;
> @@ -670,12 +671,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d)
>  			  dib0700_rc_urb_completion, d);
>  
>  	ret = usb_submit_urb(purb, GFP_ATOMIC);
> -	if (ret != 0) {
> +	if (ret != 0)

if (ret)

>  		err("rc submit urb failed\n");
> -		return -1;
> -	}
>  
> -	return 0;
> +	return ret;
>  }
>  
>  static int dib0700_probe(struct usb_interface *intf,
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2010-05-19 10:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 10:26 [PATCH] drivers/media/dvb/dvb-usb/dib0700: fix return values Daniel Mack
2010-05-19 10:34 ` Wolfram Sang [this message]
2010-05-19 10:46   ` Daniel Mack
2010-05-24  2:34     ` Devin Heitmueller
2010-05-24 10:57       ` [PATCH 1/2] " Daniel Mack
2010-05-24 11:14         ` Wolfram Sang
2010-05-24 10:57       ` [PATCH 2/2] drivers/media/dvb/dvb-usb/dib0700: CodingStyle fixes Daniel Mack
2010-05-24 11:12         ` Wolfram Sang
2010-05-24 14:35         ` David Ellingsworth
2010-05-24 15:23           ` [PATCH] " Daniel Mack
2010-05-24 15:56             ` Dmitry Torokhov
2010-05-24 16:02               ` Daniel Mack
2010-05-29  3:53                 ` Mauro Carvalho Chehab
2010-05-29  3:58                   ` Mauro Carvalho Chehab

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=20100519103448.GH5202@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=daniel@caiaq.de \
    --cc=dheitmueller@kernellabs.com \
    --cc=dtor@mail.ru \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).