From patchwork Thu Mar 2 01:35:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 9599435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25DB660453 for ; Thu, 2 Mar 2017 01:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0874C28113 for ; Thu, 2 Mar 2017 01:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEC4128544; Thu, 2 Mar 2017 01:35:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4595528113 for ; Thu, 2 Mar 2017 01:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753850AbdCBBfU (ORCPT ); Wed, 1 Mar 2017 20:35:20 -0500 Received: from smtprelay0054.hostedemail.com ([216.40.44.54]:42645 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753827AbdCBBfT (ORCPT ); Wed, 1 Mar 2017 20:35:19 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id BF291268E12; Thu, 2 Mar 2017 01:35:10 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: peace37_4a2d52ba37147 X-Filterd-Recvd-Size: 3978 Received: from joe-laptop.perches.com (unknown [47.151.132.55]) (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA; Thu, 2 Mar 2017 01:35:09 +0000 (UTC) From: Joe Perches To: Jiri Kosina , Benjamin Tissoires Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] HID: usbhid: Use pr_ and remove unnecessary OOM messages Date: Wed, 1 Mar 2017 17:35:07 -0800 Message-Id: <17564e41463d71d65783b11cb0b337363f90eecc.1488418441.git.joe@perches.com> X-Mailer: git-send-email 2.10.0.rc2.1.g053435c Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use a more common logging style and remove the unnecessary OOM messages as there is default dump_stack when OOM. Miscellanea: o Hoist an assignment in an if o Realign arguments o Realign a deeply indented if descendent above a printk Signed-off-by: Joe Perches Reviewed-by: Benjamin Tissoires --- drivers/hid/usbhid/hid-core.c | 16 +++++++--------- drivers/hid/usbhid/hid-quirks.c | 11 ++++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 961bc6fdd2d9..cd98db6cf94f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -1004,10 +1004,9 @@ static int usbhid_parse(struct hid_device *hid) return -EINVAL; } - if (!(rdesc = kmalloc(rsize, GFP_KERNEL))) { - dbg_hid("couldn't allocate rdesc memory\n"); + rdesc = kmalloc(rsize, GFP_KERNEL); + if (!rdesc) return -ENOMEM; - } hid_set_idle(dev, interface->desc.bInterfaceNumber, 0, 0); @@ -1077,8 +1076,8 @@ static int usbhid_start(struct hid_device *hid) if (hid->quirks & HID_QUIRK_FULLSPEED_INTERVAL && dev->speed == USB_SPEED_HIGH) { interval = fls(endpoint->bInterval*8); - printk(KERN_INFO "%s: Fixing fullspeed to highspeed interval: %d -> %d\n", - hid->name, endpoint->bInterval, interval); + pr_info("%s: Fixing fullspeed to highspeed interval: %d -> %d\n", + hid->name, endpoint->bInterval, interval); } /* Change the polling interval of mice. */ @@ -1456,10 +1455,9 @@ static int hid_post_reset(struct usb_interface *intf) * the size of the HID report descriptor has not changed. */ rdesc = kmalloc(hid->dev_rsize, GFP_KERNEL); - if (!rdesc) { - dbg_hid("couldn't allocate rdesc memory (post_reset)\n"); + if (!rdesc) return -ENOMEM; - } + status = hid_get_class_descriptor(dev, interface->desc.bInterfaceNumber, HID_DT_REPORT, rdesc, hid->dev_rsize); @@ -1637,7 +1635,7 @@ static int __init hid_init(void) retval = usb_register(&hid_driver); if (retval) goto usb_register_fail; - printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n"); + pr_info(KBUILD_MODNAME ": " DRIVER_DESC "\n"); return 0; usb_register_fail: diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index d6847a664446..9287ab03e117 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c @@ -237,10 +237,8 @@ static int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, } q_new = kmalloc(sizeof(struct quirks_list_struct), GFP_KERNEL); - if (!q_new) { - dbg_hid("Could not allocate quirks_list_struct\n"); + if (!q_new) return -ENOMEM; - } q_new->hid_bl_item.idVendor = idVendor; q_new->hid_bl_item.idProduct = idProduct; @@ -306,10 +304,9 @@ int usbhid_quirks_init(char **quirks_param) &idVendor, &idProduct, &quirks); if (m != 3 || - usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) { - printk(KERN_WARNING - "Could not parse HID quirk module param %s\n", - quirks_param[n]); + usbhid_modify_dquirk(idVendor, idProduct, quirks) != 0) { + pr_warn("Could not parse HID quirk module param %s\n", + quirks_param[n]); } }