Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1736750
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() |
| Date | 2017-09-21 17:10 +0200 |
| Message-ID | <usbgZ-2CM-7@gated-at.bofh.it> (permalink) |
| References | <usbgZ-2CM-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 1/4] [media] usbvision-core: Use common error handling code in usbvision_set_input() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-21 17:10 +0200
csiph-web