retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
- if (retval < 0 || size != BUFFER_LENGTH)
+ if (retval < 0 || size != BUFFER_LENGTH) {
+ amradio_dev_warn(&radio->videodev.dev, "set mute failed\n");
return retval;
+ }
radio->muted = argument;
(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
if (retval < 0 || size != BUFFER_LENGTH)
- return retval;
+ goto out_err;
/* frequency is calculated from freq_send and placed in first 2 bytes */
radio->buffer[0] = (freq_send >> 8) & 0xff;
retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
+ if (retval < 0 || size != BUFFER_LENGTH)
+ goto out_err;
+
+ goto out;
+
+out_err:
+ amradio_dev_warn(&radio->videodev.dev, "set frequency failed\n");
+out:
return retval;
}
retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
(void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
- if (retval < 0 || size != BUFFER_LENGTH)
+ if (retval < 0 || size != BUFFER_LENGTH) {
+ amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
return retval;
+ }
if (argument == WANT_STEREO)
radio->stereo = 1;
* amradio_set_stereo shouldn't be here
*/
retval = amradio_set_stereo(radio, WANT_STEREO);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev,
- "set stereo failed\n");
strcpy(v->name, "FM");
v->type = V4L2_TUNER_RADIO;
switch (v->audmode) {
case V4L2_TUNER_MODE_MONO:
retval = amradio_set_stereo(radio, WANT_MONO);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev,
- "set mono failed\n");
break;
case V4L2_TUNER_MODE_STEREO:
retval = amradio_set_stereo(radio, WANT_STEREO);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev,
- "set stereo failed\n");
break;
}
radio->curfreq = f->frequency;
retval = amradio_setfreq(radio, radio->curfreq);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev,
- "set frequency failed\n");
return retval;
}
switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE:
- if (ctrl->value) {
+ if (ctrl->value)
retval = amradio_set_mute(radio, AMRADIO_STOP);
- if (retval < 0) {
- amradio_dev_warn(&radio->videodev.dev,
- "amradio_stop failed\n");
- }
- } else {
+ else
retval = amradio_set_mute(radio, AMRADIO_START);
- if (retval < 0) {
- amradio_dev_warn(&radio->videodev.dev,
- "amradio_start failed\n");
- }
- }
+
break;
}
int retval;
retval = amradio_set_mute(radio, AMRADIO_STOP);
- if (retval < 0) {
- amradio_dev_warn(&radio->videodev.dev, "amradio_stop failed\n");
+ if (retval)
goto out_err;
- }
retval = amradio_set_stereo(radio, WANT_STEREO);
- if (retval < 0) {
- amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
+ if (retval)
goto out_err;
- }
radio->initialized = 1;
goto out;
static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
{
struct amradio_device *radio = usb_get_intfdata(intf);
- int retval;
mutex_lock(&radio->lock);
if (!radio->muted && radio->initialized) {
- retval = amradio_set_mute(radio, AMRADIO_STOP);
- if (retval < 0)
- dev_warn(&intf->dev, "amradio_stop failed\n");
+ amradio_set_mute(radio, AMRADIO_STOP);
radio->muted = 0;
}
static int usb_amradio_resume(struct usb_interface *intf)
{
struct amradio_device *radio = usb_get_intfdata(intf);
- int retval;
mutex_lock(&radio->lock);
goto unlock;
if (radio->stereo)
- retval = amradio_set_stereo(radio, WANT_STEREO);
+ amradio_set_stereo(radio, WANT_STEREO);
else
- retval = amradio_set_stereo(radio, WANT_MONO);
+ amradio_set_stereo(radio, WANT_MONO);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
+ amradio_setfreq(radio, radio->curfreq);
- retval = amradio_setfreq(radio, radio->curfreq);
- if (retval < 0)
- amradio_dev_warn(&radio->videodev.dev,
- "set frequency failed\n");
-
- if (!radio->muted) {
- retval = amradio_set_mute(radio, AMRADIO_START);
- if (retval < 0)
- dev_warn(&radio->videodev.dev,
- "amradio_start failed\n");
- }
+ if (!radio->muted)
+ amradio_set_mute(radio, AMRADIO_START);
unlock:
dev_info(&intf->dev, "coming out of suspend..\n");