Commit 6911e7e4 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: improve coding style when checking return value

use idiom 'if (rc)' for checking return value
instead of if (0 != rc)
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e0a691e3
...@@ -143,7 +143,7 @@ case NTSC_M_JP: { ...@@ -143,7 +143,7 @@ case NTSC_M_JP: {
else else
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (rc)
SAM("ERROR: failed to set SAA register " SAM("ERROR: failed to set SAA register "
"0x%02X to 0x%02X for JP standard\n", reg, set); "0x%02X to 0x%02X for JP standard\n", reg, set);
else { else {
...@@ -163,7 +163,7 @@ case NTSC_M_JP: { ...@@ -163,7 +163,7 @@ case NTSC_M_JP: {
else else
itwas = (unsigned int)ir; itwas = (unsigned int)ir;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X " SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X "
"for JP standard\n", reg, set); "for JP standard\n", reg, set);
else { else {
...@@ -241,7 +241,7 @@ else { ...@@ -241,7 +241,7 @@ else {
else else
set = itwas & ~0x40 ; set = itwas & ~0x40 ;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
reg, set); reg, set);
else { else {
...@@ -271,7 +271,7 @@ else { ...@@ -271,7 +271,7 @@ else {
else else
set = itwas & ~0x80 ; set = itwas & ~0x80 ;
rc = write_saa(peasycap->pusb_device, reg, set); rc = write_saa(peasycap->pusb_device, reg, set);
if (0 != rc) if (rc)
SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n", SAM("ERROR: failed to set SAA register 0x%02X to 0x%02X\n",
reg, set); reg, set);
else { else {
...@@ -1050,7 +1050,7 @@ case VIDIOC_QUERYCAP: { ...@@ -1050,7 +1050,7 @@ case VIDIOC_QUERYCAP: {
*p2++ = 0; *p2++ = 0;
if (3 > i) { if (3 > i) {
rc = (int) strict_strtol(p1, 10, &lng); rc = (int) strict_strtol(p1, 10, &lng);
if (0 != rc) { if (rc) {
SAM("ERROR: %i=strict_strtol(%s,.,,)\n", SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
rc, p1); rc, p1);
mutex_unlock(&easycapdc60_dongle[kd]. mutex_unlock(&easycapdc60_dongle[kd].
......
...@@ -196,7 +196,7 @@ else { ...@@ -196,7 +196,7 @@ else {
} }
peasycap->input = 0; peasycap->input = 0;
rc = reset(peasycap); rc = reset(peasycap);
if (0 != rc) { if (rc) {
SAM("ERROR: reset() returned %i\n", rc); SAM("ERROR: reset() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -452,12 +452,12 @@ if (NULL == peasycap->pusb_device) { ...@@ -452,12 +452,12 @@ if (NULL == peasycap->pusb_device) {
rc = usb_set_interface(peasycap->pusb_device, rc = usb_set_interface(peasycap->pusb_device,
peasycap->video_interface, peasycap->video_interface,
peasycap->video_altsetting_off); peasycap->video_altsetting_off);
if (0 != rc) { if (rc) {
SAM("ERROR: usb_set_interface() returned %i\n", rc); SAM("ERROR: usb_set_interface() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
rc = stop_100(peasycap->pusb_device); rc = stop_100(peasycap->pusb_device);
if (0 != rc) { if (rc) {
SAM("ERROR: stop_100() returned %i\n", rc); SAM("ERROR: stop_100() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -488,7 +488,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -488,7 +488,7 @@ if (input == peasycap->inputset[input].input) {
if (off != peasycap->standard_offset) { if (off != peasycap->standard_offset) {
rc = adjust_standard(peasycap, rc = adjust_standard(peasycap,
easycap_standard[off].v4l2_standard.id); easycap_standard[off].v4l2_standard.id);
if (0 != rc) { if (rc) {
SAM("ERROR: adjust_standard() returned %i\n", rc); SAM("ERROR: adjust_standard() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -517,7 +517,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -517,7 +517,7 @@ if (input == peasycap->inputset[input].input) {
mood = peasycap->inputset[input].brightness; mood = peasycap->inputset[input].brightness;
if (mood != peasycap->brightness) { if (mood != peasycap->brightness) {
rc = adjust_brightness(peasycap, mood); rc = adjust_brightness(peasycap, mood);
if (0 != rc) { if (rc) {
SAM("ERROR: adjust_brightness returned %i\n", rc); SAM("ERROR: adjust_brightness returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -526,7 +526,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -526,7 +526,7 @@ if (input == peasycap->inputset[input].input) {
mood = peasycap->inputset[input].contrast; mood = peasycap->inputset[input].contrast;
if (mood != peasycap->contrast) { if (mood != peasycap->contrast) {
rc = adjust_contrast(peasycap, mood); rc = adjust_contrast(peasycap, mood);
if (0 != rc) { if (rc) {
SAM("ERROR: adjust_contrast returned %i\n", rc); SAM("ERROR: adjust_contrast returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -535,7 +535,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -535,7 +535,7 @@ if (input == peasycap->inputset[input].input) {
mood = peasycap->inputset[input].saturation; mood = peasycap->inputset[input].saturation;
if (mood != peasycap->saturation) { if (mood != peasycap->saturation) {
rc = adjust_saturation(peasycap, mood); rc = adjust_saturation(peasycap, mood);
if (0 != rc) { if (rc) {
SAM("ERROR: adjust_saturation returned %i\n", rc); SAM("ERROR: adjust_saturation returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -544,7 +544,7 @@ if (input == peasycap->inputset[input].input) { ...@@ -544,7 +544,7 @@ if (input == peasycap->inputset[input].input) {
mood = peasycap->inputset[input].hue; mood = peasycap->inputset[input].hue;
if (mood != peasycap->hue) { if (mood != peasycap->hue) {
rc = adjust_hue(peasycap, mood); rc = adjust_hue(peasycap, mood);
if (0 != rc) { if (rc) {
SAM("ERROR: adjust_hue returned %i\n", rc); SAM("ERROR: adjust_hue returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -562,12 +562,12 @@ if (NULL == peasycap->pusb_device) { ...@@ -562,12 +562,12 @@ if (NULL == peasycap->pusb_device) {
rc = usb_set_interface(peasycap->pusb_device, rc = usb_set_interface(peasycap->pusb_device,
peasycap->video_interface, peasycap->video_interface,
peasycap->video_altsetting_on); peasycap->video_altsetting_on);
if (0 != rc) { if (rc) {
SAM("ERROR: usb_set_interface() returned %i\n", rc); SAM("ERROR: usb_set_interface() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
rc = start_100(peasycap->pusb_device); rc = start_100(peasycap->pusb_device);
if (0 != rc) { if (rc) {
SAM("ERROR: start_100() returned %i\n", rc); SAM("ERROR: start_100() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -1215,7 +1215,7 @@ miss++; ...@@ -1215,7 +1215,7 @@ miss++;
JOM(8, "first awakening on wq_video after %i waits\n", miss); JOM(8, "first awakening on wq_video after %i waits\n", miss);
rc = field2frame(peasycap); rc = field2frame(peasycap);
if (0 != rc) if (rc)
SAM("ERROR: field2frame() returned %i\n", rc); SAM("ERROR: field2frame() returned %i\n", rc);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -1284,7 +1284,7 @@ miss++; ...@@ -1284,7 +1284,7 @@ miss++;
JOM(8, "second awakening on wq_video after %i waits\n", miss); JOM(8, "second awakening on wq_video after %i waits\n", miss);
rc = field2frame(peasycap); rc = field2frame(peasycap);
if (0 != rc) if (rc)
SAM("ERROR: field2frame() returned %i\n", rc); SAM("ERROR: field2frame() returned %i\n", rc);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
...@@ -4134,7 +4134,7 @@ case 0: { ...@@ -4134,7 +4134,7 @@ case 0: {
JOM(8, "defaulting initially to PAL\n"); JOM(8, "defaulting initially to PAL\n");
#endif /*PREFER_NTSC*/ #endif /*PREFER_NTSC*/
rc = reset(peasycap); rc = reset(peasycap);
if (0 != rc) { if (rc) {
SAM("ERROR: reset() returned %i\n", rc); SAM("ERROR: reset() returned %i\n", rc);
return -EFAULT; return -EFAULT;
} }
...@@ -4498,7 +4498,7 @@ case 2: { ...@@ -4498,7 +4498,7 @@ case 2: {
JOM(4, "initializing ALSA card\n"); JOM(4, "initializing ALSA card\n");
rc = easycap_alsa_probe(peasycap); rc = easycap_alsa_probe(peasycap);
if (0 != rc) { if (rc) {
err("easycap_alsa_probe() returned %i\n", rc); err("easycap_alsa_probe() returned %i\n", rc);
return -ENODEV; return -ENODEV;
} else { } else {
...@@ -4510,7 +4510,7 @@ case 2: { ...@@ -4510,7 +4510,7 @@ case 2: {
#else /* CONFIG_EASYCAP_OSS */ #else /* CONFIG_EASYCAP_OSS */
rc = usb_register_dev(pusb_interface, &easyoss_class); rc = usb_register_dev(pusb_interface, &easyoss_class);
if (0 != rc) { if (rc) {
SAY("ERROR: usb_register_dev() failed\n"); SAY("ERROR: usb_register_dev() failed\n");
usb_set_intfdata(pusb_interface, NULL); usb_set_intfdata(pusb_interface, NULL);
return -ENODEV; return -ENODEV;
...@@ -4870,7 +4870,7 @@ static int __init easycap_module_init(void) ...@@ -4870,7 +4870,7 @@ static int __init easycap_module_init(void)
} }
JOT(4, "registering driver easycap\n"); JOT(4, "registering driver easycap\n");
rc = usb_register(&easycap_usb_driver); rc = usb_register(&easycap_usb_driver);
if (0 != rc) if (rc)
SAY("ERROR: usb_register returned %i\n", rc); SAY("ERROR: usb_register returned %i\n", rc);
JOT(4, "ends\n"); JOT(4, "ends\n");
......
...@@ -412,7 +412,7 @@ if (NULL == pss) { ...@@ -412,7 +412,7 @@ if (NULL == pss) {
return -EFAULT; return -EFAULT;
} }
rc = easycap_alsa_vmalloc(pss, params_buffer_bytes(phw)); rc = easycap_alsa_vmalloc(pss, params_buffer_bytes(phw));
if (0 != rc) if (rc)
return rc; return rc;
return 0; return 0;
} }
...@@ -635,7 +635,7 @@ if (true == peasycap->microphone) { ...@@ -635,7 +635,7 @@ if (true == peasycap->microphone) {
peasycap->psnd_card = psnd_card; peasycap->psnd_card = psnd_card;
rc = snd_pcm_new(psnd_card, "easycap_pcm", 0, 0, 1, &psnd_pcm); rc = snd_pcm_new(psnd_card, "easycap_pcm", 0, 0, 1, &psnd_pcm);
if (0 != rc) { if (rc) {
SAM("ERROR: Cannot do ALSA snd_pcm_new()\n"); SAM("ERROR: Cannot do ALSA snd_pcm_new()\n");
snd_card_free(psnd_card); snd_card_free(psnd_card);
return -EFAULT; return -EFAULT;
...@@ -650,7 +650,7 @@ if (true == peasycap->microphone) { ...@@ -650,7 +650,7 @@ if (true == peasycap->microphone) {
peasycap->psubstream = NULL; peasycap->psubstream = NULL;
rc = snd_card_register(psnd_card); rc = snd_card_register(psnd_card);
if (0 != rc) { if (rc) {
SAM("ERROR: Cannot do ALSA snd_card_register()\n"); SAM("ERROR: Cannot do ALSA snd_card_register()\n");
snd_card_free(psnd_card); snd_card_free(psnd_card);
return -EFAULT; return -EFAULT;
......
...@@ -292,7 +292,7 @@ peasycap->oldaudio = oldaudio; ...@@ -292,7 +292,7 @@ peasycap->oldaudio = oldaudio;
resubmit: resubmit:
if (peasycap->audio_isoc_streaming) { if (peasycap->audio_isoc_streaming) {
rc = usb_submit_urb(purb, GFP_ATOMIC); rc = usb_submit_urb(purb, GFP_ATOMIC);
if (0 != rc) { if (rc) {
if (-ENODEV != rc && -ENOENT != rc) { if (-ENODEV != rc && -ENOENT != rc) {
SAM("ERROR: while %i=audio_idle, " SAM("ERROR: while %i=audio_idle, "
"usb_submit_urb() failed " "usb_submit_urb() failed "
...@@ -532,7 +532,7 @@ while ((fragment == (peasycap->audio_fill / ...@@ -532,7 +532,7 @@ while ((fragment == (peasycap->audio_fill /
((fragment != (peasycap->audio_fill / ((fragment != (peasycap->audio_fill /
peasycap->audio_pages_per_fragment)) && peasycap->audio_pages_per_fragment)) &&
(0 < (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo)))))); (0 < (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo))))));
if (0 != rc) { if (rc) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -ERESTARTSYS; return -ERESTARTSYS;
...@@ -637,7 +637,7 @@ while (fragment == (peasycap->audio_read / ...@@ -637,7 +637,7 @@ while (fragment == (peasycap->audio_read /
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
rc = copy_to_user(puserspacebuffer, pdata_buffer->pto, more); rc = copy_to_user(puserspacebuffer, pdata_buffer->pto, more);
if (0 != rc) { if (rc) {
SAM("ERROR: copy_to_user() returned %li\n", rc); SAM("ERROR: copy_to_user() returned %li\n", rc);
mutex_unlock(&easycapdc60_dongle[kd].mutex_audio); mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment