lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201203142132.30334-1-info@metux.net>
Date:   Thu,  3 Dec 2020 15:21:32 +0100
From:   "Enrico Weigelt, metux IT consult" <info@...ux.net>
To:     linux-kernel@...r.kernel.org
Cc:     linux-usb@...r.kernel.org
Subject: [PATCH] drivers: usb: core: prefer pr_*() macros over bare printk()

pr_*() printing helpers are preferred over using bare printk().

Signed-off-by: Enrico Weigelt, metux IT consult <info@...ux.net>
---
 drivers/usb/core/devio.c | 10 +++++-----
 drivers/usb/core/file.c  |  5 ++---
 drivers/usb/core/hcd.c   |  2 +-
 drivers/usb/core/hub.c   |  2 +-
 drivers/usb/core/sysfs.c |  2 +-
 drivers/usb/core/usb.c   |  5 ++---
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 533236366a03..c65651b28ac4 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1169,7 +1169,7 @@ static int do_proc_control(struct usb_dev_state *ps,
 		snoop_urb(dev, NULL, pipe, max(i, 0), min(i, 0), COMPLETE, NULL, 0);
 	}
 	if (i < 0 && i != -EPIPE) {
-		dev_printk(KERN_DEBUG, &dev->dev, "usbfs: USBDEVFS_CONTROL "
+		dev_dbg(&dev->dev, "usbfs: USBDEVFS_CONTROL "
 			   "failed cmd %s rqt %u rq %u len %u ret %d\n",
 			   current->comm, ctrl->bRequestType, ctrl->bRequest,
 			   ctrl->wLength, i);
@@ -1861,8 +1861,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
 	}
 
 	if (ret) {
-		dev_printk(KERN_DEBUG, &ps->dev->dev,
-			   "usbfs: usb_submit_urb returned %d\n", ret);
+		dev_dbg(&ps->dev->dev,
+			"usbfs: usb_submit_urb returned %d\n", ret);
 		snoop_urb(ps->dev, as->userurb, as->urb->pipe,
 				0, ret, COMPLETE, NULL, 0);
 		async_removepending(as);
@@ -2785,13 +2785,13 @@ int __init usb_devio_init(void)
 	retval = register_chrdev_region(USB_DEVICE_DEV, USB_DEVICE_MAX,
 					"usb_device");
 	if (retval) {
-		printk(KERN_ERR "Unable to register minors for usb_device\n");
+		pr_err("Unable to register minors for usb_device\n");
 		goto out;
 	}
 	cdev_init(&usb_device_cdev, &usbdev_file_operations);
 	retval = cdev_add(&usb_device_cdev, USB_DEVICE_DEV, USB_DEVICE_MAX);
 	if (retval) {
-		printk(KERN_ERR "Unable to get usb_device major %d\n",
+		pr_err("Unable to get usb_device major %d\n",
 		       USB_DEVICE_MAJOR);
 		goto error_cdev;
 	}
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 558890ada0e5..760866d38f8a 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -91,7 +91,7 @@ static int init_usb_class(void)
 	usb_class->class = class_create(THIS_MODULE, "usbmisc");
 	if (IS_ERR(usb_class->class)) {
 		result = PTR_ERR(usb_class->class);
-		printk(KERN_ERR "class_create failed for usb devices\n");
+		pr_err("class_create failed for usb devices\n");
 		kfree(usb_class);
 		usb_class = NULL;
 		goto exit;
@@ -123,8 +123,7 @@ int usb_major_init(void)
 
 	error = register_chrdev(USB_MAJOR, "usb", &usb_fops);
 	if (error)
-		printk(KERN_ERR "Unable to get major %d for usb devices\n",
-		       USB_MAJOR);
+		pr_err("Unable to get major %d for usb devices\n", USB_MAJOR);
 
 	return error;
 }
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 2c6b9578a7d3..ef74cb8b58e6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2979,7 +2979,7 @@ void usb_mon_deregister (void)
 {
 
 	if (mon_ops == NULL) {
-		printk(KERN_ERR "USB: monitor was not registered\n");
+		pr_err("USB: monitor was not registered\n");
 		return;
 	}
 	mon_ops = NULL;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 17202b2ee063..b542db35ee3f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5674,7 +5674,7 @@ static struct usb_driver hub_driver = {
 int usb_hub_init(void)
 {
 	if (usb_register(&hub_driver) < 0) {
-		printk(KERN_ERR "%s: can't register hub driver\n",
+		pr_err("%s: can't register hub driver\n",
 			usbcore_name);
 		return -1;
 	}
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index 8d134193fa0c..7b09c35c3928 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -448,7 +448,7 @@ static void warn_level(void)
 
 	if (!level_warned) {
 		level_warned = 1;
-		printk(KERN_WARNING "WARNING! power/level is deprecated; "
+		pr_warn("WARNING! power/level is deprecated; "
 				"use power/control instead\n");
 	}
 }
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 9b4ac4415f1a..5f67e5f511c1 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -241,7 +241,7 @@ struct usb_host_interface *usb_find_alt_setting(
 		if (intf_cache->altsetting[i].desc.bAlternateSetting == alt_num)
 			return &intf_cache->altsetting[i];
 
-	printk(KERN_DEBUG "Did not find alt setting %u for intf %u, "
+	pr_debug("Did not find alt setting %u for intf %u, "
 			"config %u\n", alt_num, iface_num,
 			config->desc.bConfigurationValue);
 	return NULL;
@@ -846,8 +846,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
 		header = (struct usb_descriptor_header *)buffer;
 
 		if (header->bLength < 2 || header->bLength > size) {
-			printk(KERN_ERR
-				"%s: bogus descriptor, type %d length %d\n",
+			pr_err("%s: bogus descriptor, type %d length %d\n",
 				usbcore_name,
 				header->bDescriptorType,
 				header->bLength);
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ