* [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations
@ 2017-09-21 15:04 SF Markus Elfring
  2017-09-21 15:06 ` [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() SF Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-21 15:04 UTC (permalink / raw)
  To: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus
  Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 21 Sep 2017 17:00:17 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (4):
  Use common error handling code in usbvision_set_input()
  Use common error handling code in usbvision_set_compress_params()
  Delete unnecessary braces in 11 functions
  Replace four printk() calls by dev_err()
 drivers/media/usb/usbvision/usbvision-core.c | 128 ++++++++++++---------------
 1 file changed, 58 insertions(+), 70 deletions(-)
-- 
2.14.1
^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input()
  2017-09-21 15:04 [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations SF Markus Elfring
@ 2017-09-21 15:06 ` SF Markus Elfring
  2017-09-21 15:07 ` [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params() SF Markus Elfring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-21 15:06 UTC (permalink / raw)
  To: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus
  Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 21 Sep 2017 11:50:54 +0200
* Add a jump target so that a bit of exception handling can be better
  reused at the end of this function.
  This issue was detected by using the Coccinelle software.
* Replace the local variable "proc" by the identifier "__func__".
* Use the interface "dev_err" instead of "printk".
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/usbvision/usbvision-core.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
index 3f87fbc80be2..16b76c85eeec 100644
--- a/drivers/media/usb/usbvision/usbvision-core.c
+++ b/drivers/media/usb/usbvision/usbvision-core.c
@@ -1931,7 +1931,6 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
  */
 int usbvision_set_input(struct usb_usbvision *usbvision)
 {
-	static const char proc[] = "usbvision_set_input: ";
 	int rc;
 	unsigned char *value = usbvision->ctrl_urb_buffer;
 	unsigned char dvi_yuv_value;
@@ -1953,12 +1952,8 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
 	}
 
 	rc = usbvision_write_reg(usbvision, USBVISION_VIN_REG1, value[0]);
-	if (rc < 0) {
-		printk(KERN_ERR "%sERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
-		       proc, rc);
-		return rc;
-	}
-
+	if (rc < 0)
+		goto report_failure;
 
 	if (usbvision->tvnorm_id & V4L2_STD_PAL) {
 		value[0] = 0xC0;
@@ -2019,12 +2014,8 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
 			     USBVISION_OP_CODE,	/* USBVISION specific code */
 			     USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, 0,
 			     (__u16) USBVISION_LXSIZE_I, value, 8, HZ);
-	if (rc < 0) {
-		printk(KERN_ERR "%sERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
-		       proc, rc);
-		return rc;
-	}
-
+	if (rc < 0)
+		goto report_failure;
 
 	dvi_yuv_value = 0x00;	/* U comes after V, Ya comes after U/V, Yb comes after Yb */
 
@@ -2036,6 +2027,12 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
 	}
 
 	return usbvision_write_reg(usbvision, USBVISION_DVI_YUV, dvi_yuv_value);
+
+report_failure:
+	dev_err(&usbvision->dev->dev,
+		"%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
+		__func__, rc);
+	return rc;
 }
 
 
-- 
2.14.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params()
  2017-09-21 15:04 [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations SF Markus Elfring
  2017-09-21 15:06 ` [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() SF Markus Elfring
@ 2017-09-21 15:07 ` SF Markus Elfring
  2017-09-22 11:44   ` Dan Carpenter
  2017-09-21 15:08 ` [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions SF Markus Elfring
  2017-09-21 15:09 ` [PATCH 4/4] [media] usbvision-core: Replace four printk() calls by dev_err() SF Markus Elfring
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-21 15:07 UTC (permalink / raw)
  To: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus
  Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 21 Sep 2017 12:45:49 +0200
* Add a jump target so that a bit of exception handling can be better
  reused at the end of this function.
* Replace the local variable "proc" by the identifier "__func__".
* Use the interface "dev_err" instead of "printk".
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/usbvision/usbvision-core.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
index 16b76c85eeec..bb6f4f69165f 100644
--- a/drivers/media/usb/usbvision/usbvision-core.c
+++ b/drivers/media/usb/usbvision/usbvision-core.c
@@ -1857,7 +1857,6 @@ int usbvision_stream_interrupt(struct usb_usbvision *usbvision)
 
 static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
 {
-	static const char proc[] = "usbvision_set_compresion_params: ";
 	int rc;
 	unsigned char *value = usbvision->ctrl_urb_buffer;
 
@@ -1882,12 +1881,8 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
 			     USB_DIR_OUT | USB_TYPE_VENDOR |
 			     USB_RECIP_ENDPOINT, 0,
 			     (__u16) USBVISION_INTRA_CYC, value, 5, HZ);
-
-	if (rc < 0) {
-		printk(KERN_ERR "%sERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
-		       proc, rc);
-		return rc;
-	}
+	if (rc < 0)
+		goto report_failure;
 
 	if (usbvision->bridge_type == BRIDGE_NT1004) {
 		value[0] =  20; /* PCM Threshold 1 */
@@ -1913,11 +1908,12 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
 			     USB_DIR_OUT | USB_TYPE_VENDOR |
 			     USB_RECIP_ENDPOINT, 0,
 			     (__u16) USBVISION_PCM_THR1, value, 6, HZ);
+	if (rc < 0)
+report_failure:
+		dev_err(&usbvision->dev->dev,
+			"%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
+			__func__, rc);
 
-	if (rc < 0) {
-		printk(KERN_ERR "%sERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
-		       proc, rc);
-	}
 	return rc;
 }
 
-- 
2.14.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions
  2017-09-21 15:04 [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations SF Markus Elfring
  2017-09-21 15:06 ` [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() SF Markus Elfring
  2017-09-21 15:07 ` [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params() SF Markus Elfring
@ 2017-09-21 15:08 ` SF Markus Elfring
  2017-09-22 11:42   ` Dan Carpenter
  2017-09-21 15:09 ` [PATCH 4/4] [media] usbvision-core: Replace four printk() calls by dev_err() SF Markus Elfring
  3 siblings, 1 reply; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-21 15:08 UTC (permalink / raw)
  To: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus
  Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 21 Sep 2017 16:24:20 +0200
Do not use curly brackets at some source code places
where a single statement should be sufficient.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/usbvision/usbvision-core.c | 71 ++++++++++++----------------
 1 file changed, 31 insertions(+), 40 deletions(-)
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
index bb6f4f69165f..54db35b03106 100644
--- a/drivers/media/usb/usbvision/usbvision-core.c
+++ b/drivers/media/usb/usbvision/usbvision-core.c
@@ -188,10 +188,9 @@ static int scratch_free(struct usb_usbvision *usbvision)
 	int free = usbvision->scratch_read_ptr - usbvision->scratch_write_ptr;
 	if (free <= 0)
 		free += scratch_buf_size;
-	if (free) {
+	if (free)
 		free -= 1;							/* at least one byte in the buffer must */
 										/* left blank, otherwise there is no chance to differ between full and empty */
-	}
 	PDEBUG(DBG_SCRATCH, "return %d\n", free);
 
 	return free;
@@ -699,11 +698,12 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
 
 	frame = usbvision->cur_frame;
 	image_size = frame->frmwidth * frame->frmheight;
-	if ((frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) ||
-	    (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420)) {       /* this is a planar format */
+	if (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P ||
+	    frame->v4l2_format.format == V4L2_PIX_FMT_YVU420)
+		/* this is a planar format */
 		/* ... v4l2_linesize not used here. */
 		f = frame->data + (frame->width * frame->curline);
-	} else
+	else
 		f = frame->data + (frame->v4l2_linesize * frame->curline);
 
 	if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { /* initialise u and v pointers */
@@ -734,22 +734,19 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
 		return parse_state_next_frame;
 	}
 
-	if (frame->curline != (int)strip_header[2]) {
+	if (frame->curline != (int)strip_header[2])
 		/* line number mismatch error */
 		usbvision->strip_line_number_errors++;
-	}
 
 	strip_len = 2 * (unsigned int)strip_header[1];
-	if (strip_len > USBVISION_STRIP_LEN_MAX) {
+	if (strip_len > USBVISION_STRIP_LEN_MAX)
 		/* strip overrun */
 		/* I think this never happens */
 		usbvision_request_intra(usbvision);
-	}
 
-	if (scratch_len(usbvision) < strip_len) {
+	if (scratch_len(usbvision) < strip_len)
 		/* there is not enough data for the strip */
 		return parse_state_out;
-	}
 
 	if (usbvision->intra_frame_buffer) {
 		Y = usbvision->intra_frame_buffer + frame->frmwidth * frame->curline;
@@ -1306,11 +1303,11 @@ static void usbvision_isoc_irq(struct urb *urb)
 		/* If we collected enough data let's parse! */
 		if (scratch_len(usbvision) > USBVISION_HEADER_LENGTH &&
 		    !list_empty(&(usbvision->inqueue))) {
-			if (!(*f)) {
+			if (!(*f))
 				(*f) = list_entry(usbvision->inqueue.next,
 						  struct usbvision_frame,
 						  frame);
-			}
+
 			usbvision_parse_data(usbvision);
 		} else {
 			/* If we don't have a frame
@@ -1334,12 +1331,10 @@ static void usbvision_isoc_irq(struct urb *urb)
 	urb->status = 0;
 	urb->dev = usbvision->dev;
 	err_code = usb_submit_urb(urb, GFP_ATOMIC);
-
-	if (err_code) {
+	if (err_code)
 		dev_err(&usbvision->dev->dev,
 			"%s: usb_submit_urb failed: error %d\n",
 				__func__, err_code);
-	}
 
 	return;
 }
@@ -1398,11 +1393,10 @@ int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg,
 				USB_DIR_OUT | USB_TYPE_VENDOR |
 				USB_RECIP_ENDPOINT, 0, (__u16) reg,
 				usbvision->ctrl_urb_buffer, 1, HZ);
-
-	if (err_code < 0) {
+	if (err_code < 0)
 		dev_err(&usbvision->dev->dev,
 			"%s: failed: error %d\n", __func__, err_code);
-	}
+
 	return err_code;
 }
 
@@ -1443,10 +1437,10 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision, int address,
 	memcpy(usbvision->ctrl_urb_buffer, data, len);
 
 	err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC);
-	if (err_code < 0) {
+	if (err_code < 0)
 		/* error in usb_submit_urb() */
 		usbvision->ctrl_urb_busy = 0;
-	}
+
 	PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code);
 	return err_code;
 }
@@ -1477,11 +1471,11 @@ static int usbvision_measure_bandwidth(struct usb_usbvision *usbvision)
 		usbvision->isoc_measure_bandwidth_count++;
 		return 0;
 	}
-	if ((usbvision->isoc_packet_size > 0) && (usbvision->isoc_packet_count > 0)) {
+	if (usbvision->isoc_packet_size > 0 && usbvision->isoc_packet_count > 0)
 		usbvision->used_bandwidth = usbvision->isoc_data_count /
 					(usbvision->isoc_packet_count + usbvision->isoc_skip_count) *
 					100 / usbvision->isoc_packet_size;
-	}
+
 	usbvision->isoc_measure_bandwidth_count = 0;
 	usbvision->isoc_data_count = 0;
 	usbvision->isoc_packet_count = 0;
@@ -1648,11 +1642,10 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma
 			     USB_DIR_OUT | USB_TYPE_VENDOR |
 			     USB_RECIP_ENDPOINT, 0,
 			     (__u16) USBVISION_FILT_CONT, value, 2, HZ);
-
-	if (rc < 0) {
+	if (rc < 0)
 		printk(KERN_ERR "%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
 		       proc, rc);
-	}
+
 	usbvision->isoc_mode = format;
 	return rc;
 }
@@ -1935,17 +1928,17 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
 		return 0;
 
 	/* Set input format expected from decoder*/
-	if (usbvision_device_data[usbvision->dev_model].vin_reg1_override) {
+	if (usbvision_device_data[usbvision->dev_model].vin_reg1_override)
 		value[0] = usbvision_device_data[usbvision->dev_model].vin_reg1;
-	} else if (usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) {
+	else if (usbvision_device_data[usbvision->dev_model].codec
+		 == CODEC_SAA7113)
 		/* SAA7113 uses 8 bit output */
 		value[0] = USBVISION_8_422_SYNC;
-	} else {
+	else
 		/* I'm sure only about d2-d0 [010] 16 bit 4:2:2 usin sync pulses
 		 * as that is how saa7111 is configured */
 		value[0] = USBVISION_16_422_SYNC;
 		/* | USBVISION_VSNC_POL | USBVISION_VCLK_POL);*/
-	}
 
 	rc = usbvision_write_reg(usbvision, USBVISION_VIN_REG1, value[0]);
 	if (rc < 0)
@@ -2015,12 +2008,12 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
 
 	dvi_yuv_value = 0x00;	/* U comes after V, Ya comes after U/V, Yb comes after Yb */
 
-	if (usbvision_device_data[usbvision->dev_model].dvi_yuv_override) {
+	if (usbvision_device_data[usbvision->dev_model].dvi_yuv_override)
 		dvi_yuv_value = usbvision_device_data[usbvision->dev_model].dvi_yuv;
-	} else if (usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) {
+	else if (usbvision_device_data[usbvision->dev_model].codec
+		 == CODEC_SAA7113)
 		/* This changes as the fine sync control changes. Further investigation necessary */
 		dvi_yuv_value = 0x06;
-	}
 
 	return usbvision_write_reg(usbvision, USBVISION_DVI_YUV, dvi_yuv_value);
 
@@ -2320,11 +2313,10 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
 	for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) {
 		err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb,
 					 GFP_KERNEL);
-		if (err_code) {
+		if (err_code)
 			dev_err(&usbvision->dev->dev,
 				"%s: usb_submit_urb(%d) failed: error %d\n",
 					__func__, buf_idx, err_code);
-		}
 	}
 
 	usbvision->streaming = stream_idle;
@@ -2352,12 +2344,12 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision)
 	/* Unschedule all of the iso td's */
 	for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) {
 		usb_kill_urb(usbvision->sbuf[buf_idx].urb);
-		if (usbvision->sbuf[buf_idx].data) {
+		if (usbvision->sbuf[buf_idx].data)
 			usb_free_coherent(usbvision->dev,
 					  sb_size,
 					  usbvision->sbuf[buf_idx].data,
 					  usbvision->sbuf[buf_idx].urb->transfer_dma);
-		}
+
 		usb_free_urb(usbvision->sbuf[buf_idx].urb);
 		usbvision->sbuf[buf_idx].urb = NULL;
 	}
@@ -2409,14 +2401,13 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
 	switch (usbvision_device_data[usbvision->dev_model].codec) {
 	case CODEC_SAA7113:
 		mode[1] = SAA7115_COMPOSITE2;
-		if (switch_svideo_input) {
+		if (switch_svideo_input)
 			/* To handle problems with S-Video Input for
 			 * some devices.  Use switch_svideo_input
 			 * parameter when loading the module.*/
 			mode[2] = SAA7115_COMPOSITE1;
-		} else {
+		else
 			mode[2] = SAA7115_SVIDEO1;
-		}
 		break;
 	case CODEC_SAA7111:
 	default:
-- 
2.14.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH 4/4] [media] usbvision-core: Replace four printk() calls by dev_err()
  2017-09-21 15:04 [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations SF Markus Elfring
                   ` (2 preceding siblings ...)
  2017-09-21 15:08 ` [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions SF Markus Elfring
@ 2017-09-21 15:09 ` SF Markus Elfring
  3 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-21 15:09 UTC (permalink / raw)
  To: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus
  Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 21 Sep 2017 16:47:28 +0200
* Replace the local variable "proc" by the identifier "__func__".
* Use the interface "dev_err" instead of "printk" in these functions.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/usb/usbvision/usbvision-core.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
index 54db35b03106..2c98805244df 100644
--- a/drivers/media/usb/usbvision/usbvision-core.c
+++ b/drivers/media/usb/usbvision/usbvision-core.c
@@ -1619,7 +1619,6 @@ static int usbvision_init_webcam(struct usb_usbvision *usbvision)
  */
 static int usbvision_set_video_format(struct usb_usbvision *usbvision, int format)
 {
-	static const char proc[] = "usbvision_set_video_format";
 	unsigned char *value = usbvision->ctrl_urb_buffer;
 	int rc;
 
@@ -1631,8 +1630,9 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma
 	if ((format != ISOC_MODE_YUV422)
 	    && (format != ISOC_MODE_YUV420)
 	    && (format != ISOC_MODE_COMPRESS)) {
-		printk(KERN_ERR "usbvision: unknown video format %02x, using default YUV420",
-		       format);
+		dev_err(&usbvision->dev->dev,
+			"%s: unknown video format %02x, using default YUV420\n",
+			__func__, format);
 		format = ISOC_MODE_YUV420;
 	}
 	value[0] = 0x0A;  /* TODO: See the effect of the filter */
@@ -1643,8 +1643,9 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma
 			     USB_RECIP_ENDPOINT, 0,
 			     (__u16) USBVISION_FILT_CONT, value, 2, HZ);
 	if (rc < 0)
-		printk(KERN_ERR "%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
-		       proc, rc);
+		dev_err(&usbvision->dev->dev,
+			"%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
+			__func__, rc);
 
 	usbvision->isoc_mode = format;
 	return rc;
@@ -2180,7 +2181,8 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision)
 int usbvision_audio_off(struct usb_usbvision *usbvision)
 {
 	if (usbvision_write_reg(usbvision, USBVISION_IOPIN_REG, USBVISION_AUDIO_MUTE) < 0) {
-		printk(KERN_ERR "usbvision_audio_off: can't write reg\n");
+		dev_err(&usbvision->dev->dev,
+			"%s: can't write reg\n", __func__);
 		return -1;
 	}
 	usbvision->audio_mute = 0;
@@ -2192,7 +2194,9 @@ int usbvision_set_audio(struct usb_usbvision *usbvision, int audio_channel)
 {
 	if (!usbvision->audio_mute) {
 		if (usbvision_write_reg(usbvision, USBVISION_IOPIN_REG, audio_channel) < 0) {
-			printk(KERN_ERR "usbvision_set_audio: can't write iopin register for audio switching\n");
+			dev_err(&usbvision->dev->dev,
+				"%s: can't write iopin register for audio switching\n",
+				__func__);
 			return -1;
 		}
 	}
-- 
2.14.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions
  2017-09-21 15:08 ` [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions SF Markus Elfring
@ 2017-09-22 11:42   ` Dan Carpenter
  2017-09-22 15:03     ` SF Markus Elfring
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2017-09-22 11:42 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus, LKML, kernel-janitors
No.  Multi-line indents get curly braces for readability.
regards,
dan carpenter
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params()
  2017-09-21 15:07 ` [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params() SF Markus Elfring
@ 2017-09-22 11:44   ` Dan Carpenter
  2017-09-22 14:50     ` SF Markus Elfring
  0 siblings, 1 reply; 9+ messages in thread
From: Dan Carpenter @ 2017-09-22 11:44 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-media, Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus, LKML, kernel-janitors
On Thu, Sep 21, 2017 at 05:07:06PM +0200, SF Markus Elfring wrote:
> @@ -1913,11 +1908,12 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
>  			     USB_DIR_OUT | USB_TYPE_VENDOR |
>  			     USB_RECIP_ENDPOINT, 0,
>  			     (__u16) USBVISION_PCM_THR1, value, 6, HZ);
> +	if (rc < 0)
> +report_failure:
> +		dev_err(&usbvision->dev->dev,
> +			"%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
> +			__func__, rc);
You've been asked several times not to write code like this.  You do
it later in the patch series as well.
regards,
dan carpenter
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params()
  2017-09-22 11:44   ` Dan Carpenter
@ 2017-09-22 14:50     ` SF Markus Elfring
  0 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-22 14:50 UTC (permalink / raw)
  To: Dan Carpenter, linux-media
  Cc: Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus, LKML, kernel-janitors
>> @@ -1913,11 +1908,12 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
>>  			     USB_DIR_OUT | USB_TYPE_VENDOR |
>>  			     USB_RECIP_ENDPOINT, 0,
>>  			     (__u16) USBVISION_PCM_THR1, value, 6, HZ);
>> +	if (rc < 0)
>> +report_failure:
>> +		dev_err(&usbvision->dev->dev,
>> +			"%s: ERROR=%d. USBVISION stopped - reconnect or reload driver.\n",
>> +			__func__, rc);
> 
> You've been asked several times not to write code like this.
This suggestion occurred a few times.
Do you prefer to move this place to the end together with a duplicated statement “return rc;”?
> You do it later in the patch series as well.
To which update step do you refer here?
Regards,
Markus
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [media] usbvision-core: Delete unnecessary braces in 11 functions
  2017-09-22 11:42   ` Dan Carpenter
@ 2017-09-22 15:03     ` SF Markus Elfring
  0 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-09-22 15:03 UTC (permalink / raw)
  To: Dan Carpenter, linux-media
  Cc: Davidlohr Bueso, Hans Verkuil, Mauro Carvalho Chehab,
	Sakari Ailus, LKML, kernel-janitors
> No.  Multi-line indents get curly braces for readability.
Which of the proposed change possibilities do you not like especially at the moment?
Regards,
Markus
^ permalink raw reply	[flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-22 15:03 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-21 15:04 [PATCH 0/4] [media] usbvision-core: Fine-tuning for some function implementations SF Markus Elfring
2017-09-21 15:06 ` [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() SF Markus Elfring
2017-09-21 15:07 ` [PATCH 2/4] [media] usbvision-core: Use common error handling code in usbvision_set_compress_params() SF Markus Elfring
2017-09-22 11:44   ` Dan Carpenter
2017-09-22 14:50     ` SF Markus Elfring
2017-09-21 15:08 ` [PATCH 3/4] [media] usbvision-core: Delete unnecessary braces in 11 functions SF Markus Elfring
2017-09-22 11:42   ` Dan Carpenter
2017-09-22 15:03     ` SF Markus Elfring
2017-09-21 15:09 ` [PATCH 4/4] [media] usbvision-core: Replace four printk() calls by dev_err() SF Markus Elfring
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).