[PATCH 225/961] staging/easycap: improve coding style when checking return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tomas Winkler <tomas.winkler@xxxxxxxxx>

use idiom 'if (rc)' for checking return value
instead of if (0 != rc)

Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/easycap/easycap_ioctl.c     |   10 ++++----
 drivers/staging/easycap/easycap_main.c      |   32 +++++++++++++-------------
 drivers/staging/easycap/easycap_sound.c     |    6 ++--
 drivers/staging/easycap/easycap_sound_oss.c |    6 ++--
 4 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c
index 4754f2f..73cb0d4 100644
--- a/drivers/staging/easycap/easycap_ioctl.c
+++ b/drivers/staging/easycap/easycap_ioctl.c
@@ -143,7 +143,7 @@ case NTSC_M_JP: {
 	else
 		itwas = (unsigned int)ir;
 	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 for JP standard\n", reg, set);
 	else {
@@ -163,7 +163,7 @@ case NTSC_M_JP: {
 	else
 		itwas = (unsigned int)ir;
 	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 "
 						"for JP standard\n", reg, set);
 	else {
@@ -241,7 +241,7 @@ else {
 	else
 		set = itwas & ~0x40 ;
 	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",
 								reg, set);
 	else {
@@ -271,7 +271,7 @@ else {
 	else
 		set = itwas & ~0x80 ;
 	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",
 								reg, set);
 	else {
@@ -1050,7 +1050,7 @@ case VIDIOC_QUERYCAP: {
 			*p2++ = 0;
 		if (3 > i) {
 			rc = (int) strict_strtol(p1, 10, &lng);
-			if (0 != rc) {
+			if (rc) {
 				SAM("ERROR: %i=strict_strtol(%s,.,,)\n",
 								rc, p1);
 				mutex_unlock(&easycapdc60_dongle[kd].
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index c453633..21d155a 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -196,7 +196,7 @@ else {
 }
 peasycap->input = 0;
 rc = reset(peasycap);
-if (0 != rc) {
+if (rc) {
 	SAM("ERROR: reset() returned %i\n", rc);
 	return -EFAULT;
 }
@@ -452,12 +452,12 @@ if (NULL == peasycap->pusb_device) {
 rc = usb_set_interface(peasycap->pusb_device,
 			peasycap->video_interface,
 			peasycap->video_altsetting_off);
-if (0 != rc) {
+if (rc) {
 	SAM("ERROR: usb_set_interface() returned %i\n", rc);
 	return -EFAULT;
 }
 rc = stop_100(peasycap->pusb_device);
-if (0 != rc) {
+if (rc) {
 	SAM("ERROR: stop_100() returned %i\n", rc);
 	return -EFAULT;
 }
@@ -488,7 +488,7 @@ if (input == peasycap->inputset[input].input) {
 	if (off != peasycap->standard_offset) {
 		rc = adjust_standard(peasycap,
 				easycap_standard[off].v4l2_standard.id);
-		if (0 != rc) {
+		if (rc) {
 			SAM("ERROR: adjust_standard() returned %i\n", rc);
 			return -EFAULT;
 		}
@@ -517,7 +517,7 @@ if (input == peasycap->inputset[input].input) {
 	mood = peasycap->inputset[input].brightness;
 	if (mood != peasycap->brightness) {
 		rc = adjust_brightness(peasycap, mood);
-		if (0 != rc) {
+		if (rc) {
 			SAM("ERROR: adjust_brightness returned %i\n", rc);
 			return -EFAULT;
 		}
@@ -526,7 +526,7 @@ if (input == peasycap->inputset[input].input) {
 	mood = peasycap->inputset[input].contrast;
 	if (mood != peasycap->contrast) {
 		rc = adjust_contrast(peasycap, mood);
-		if (0 != rc) {
+		if (rc) {
 			SAM("ERROR: adjust_contrast returned %i\n", rc);
 			return -EFAULT;
 		}
@@ -535,7 +535,7 @@ if (input == peasycap->inputset[input].input) {
 	mood = peasycap->inputset[input].saturation;
 	if (mood != peasycap->saturation) {
 		rc = adjust_saturation(peasycap, mood);
-		if (0 != rc) {
+		if (rc) {
 			SAM("ERROR: adjust_saturation returned %i\n", rc);
 			return -EFAULT;
 		}
@@ -544,7 +544,7 @@ if (input == peasycap->inputset[input].input) {
 	mood = peasycap->inputset[input].hue;
 	if (mood != peasycap->hue) {
 		rc = adjust_hue(peasycap, mood);
-		if (0 != rc) {
+		if (rc) {
 			SAM("ERROR: adjust_hue returned %i\n", rc);
 			return -EFAULT;
 		}
@@ -562,12 +562,12 @@ if (NULL == peasycap->pusb_device) {
 rc = usb_set_interface(peasycap->pusb_device,
 			peasycap->video_interface,
 			peasycap->video_altsetting_on);
-if (0 != rc) {
+if (rc) {
 	SAM("ERROR: usb_set_interface() returned %i\n", rc);
 	return -EFAULT;
 }
 rc = start_100(peasycap->pusb_device);
-if (0 != rc) {
+if (rc) {
 	SAM("ERROR: start_100() returned %i\n", rc);
 	return -EFAULT;
 }
@@ -1215,7 +1215,7 @@ miss++;
 JOM(8, "first awakening on wq_video after %i waits\n", miss);
 
 rc = field2frame(peasycap);
-if (0 != rc)
+if (rc)
 	SAM("ERROR: field2frame() returned %i\n", rc);
 /*---------------------------------------------------------------------------*/
 /*
@@ -1284,7 +1284,7 @@ miss++;
 JOM(8, "second awakening on wq_video after %i waits\n", miss);
 
 rc = field2frame(peasycap);
-if (0 != rc)
+if (rc)
 	SAM("ERROR: field2frame() returned %i\n", rc);
 /*---------------------------------------------------------------------------*/
 /*
@@ -4134,7 +4134,7 @@ case 0: {
 	JOM(8, "defaulting initially to PAL\n");
 #endif /*PREFER_NTSC*/
 	rc = reset(peasycap);
-	if (0 != rc) {
+	if (rc) {
 		SAM("ERROR: reset() returned %i\n", rc);
 		return -EFAULT;
 	}
@@ -4498,7 +4498,7 @@ case 2: {
 	JOM(4, "initializing ALSA card\n");
 
 	rc = easycap_alsa_probe(peasycap);
-	if (0 != rc) {
+	if (rc) {
 		err("easycap_alsa_probe() returned %i\n", rc);
 		return -ENODEV;
 	} else {
@@ -4510,7 +4510,7 @@ case 2: {
 
 #else /* CONFIG_EASYCAP_OSS */
 	rc = usb_register_dev(pusb_interface, &easyoss_class);
-	if (0 != rc) {
+	if (rc) {
 		SAY("ERROR: usb_register_dev() failed\n");
 		usb_set_intfdata(pusb_interface, NULL);
 		return -ENODEV;
@@ -4870,7 +4870,7 @@ static int __init easycap_module_init(void)
 	}
 	JOT(4, "registering driver easycap\n");
 	rc = usb_register(&easycap_usb_driver);
-	if (0 != rc)
+	if (rc)
 		SAY("ERROR:  usb_register returned %i\n", rc);
 
 	JOT(4, "ends\n");
diff --git a/drivers/staging/easycap/easycap_sound.c b/drivers/staging/easycap/easycap_sound.c
index 7c07dbc..f5c4645 100644
--- a/drivers/staging/easycap/easycap_sound.c
+++ b/drivers/staging/easycap/easycap_sound.c
@@ -412,7 +412,7 @@ if (NULL == pss) {
 	return -EFAULT;
 }
 rc = easycap_alsa_vmalloc(pss, params_buffer_bytes(phw));
-if (0 != rc)
+if (rc)
 	return rc;
 return 0;
 }
@@ -635,7 +635,7 @@ if (true == peasycap->microphone) {
 	peasycap->psnd_card = psnd_card;
 
 	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");
 		snd_card_free(psnd_card);
 		return -EFAULT;
@@ -650,7 +650,7 @@ if (true == peasycap->microphone) {
 	peasycap->psubstream = NULL;
 
 	rc = snd_card_register(psnd_card);
-	if (0 != rc) {
+	if (rc) {
 		SAM("ERROR: Cannot do ALSA snd_card_register()\n");
 		snd_card_free(psnd_card);
 		return -EFAULT;
diff --git a/drivers/staging/easycap/easycap_sound_oss.c b/drivers/staging/easycap/easycap_sound_oss.c
index adf8031..2fccb4c 100644
--- a/drivers/staging/easycap/easycap_sound_oss.c
+++ b/drivers/staging/easycap/easycap_sound_oss.c
@@ -292,7 +292,7 @@ peasycap->oldaudio = oldaudio;
 resubmit:
 if (peasycap->audio_isoc_streaming) {
 	rc = usb_submit_urb(purb, GFP_ATOMIC);
-	if (0 != rc) {
+	if (rc) {
 		if (-ENODEV != rc && -ENOENT != rc) {
 			SAM("ERROR: while %i=audio_idle, "
 				"usb_submit_urb() failed "
@@ -532,7 +532,7 @@ while ((fragment == (peasycap->audio_fill /
 		((fragment != (peasycap->audio_fill /
 				peasycap->audio_pages_per_fragment)) &&
 		(0 < (PAGE_SIZE - (pdata_buffer->pto - pdata_buffer->pgo))))));
-	if (0 != rc) {
+	if (rc) {
 		SAM("aborted by signal\n");
 		mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
 		return -ERESTARTSYS;
@@ -637,7 +637,7 @@ while (fragment == (peasycap->audio_read /
 	}
 /*---------------------------------------------------------------------------*/
 	rc = copy_to_user(puserspacebuffer, pdata_buffer->pto, more);
-	if (0 != rc) {
+	if (rc) {
 		SAM("ERROR: copy_to_user() returned %li\n", rc);
 		mutex_unlock(&easycapdc60_dongle[kd].mutex_audio);
 		return -EFAULT;
-- 
1.7.4.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux