From patchwork Tue Feb 7 19:57:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9561041 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 EE3476047A for ; Tue, 7 Feb 2017 20:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFAE52848D for ; Tue, 7 Feb 2017 20:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2B5128495; Tue, 7 Feb 2017 20:04:20 +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 5A5732848D for ; Tue, 7 Feb 2017 20:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754234AbdBGUET (ORCPT ); Tue, 7 Feb 2017 15:04:19 -0500 Received: from mout.web.de ([217.72.192.78]:62549 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753909AbdBGUES (ORCPT ); Tue, 7 Feb 2017 15:04:18 -0500 Received: from [192.168.1.2] ([78.49.4.3]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MVLak-1cvaqm1Fx0-00Yf25; Tue, 07 Feb 2017 20:57:34 +0100 Subject: [PATCH 14/18] HID-debug: Adjust two function calls together with a variable assignment To: linux-input@vger.kernel.org, Benjamin Tissoires , =?UTF-8?Q?Bruno_Pr=c3=a9mont?= , Jiri Kosina References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <79f4cfa3-b21b-946c-e108-654400f3f62c@users.sourceforge.net> Date: Tue, 7 Feb 2017 20:57:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:XG0LzyLc2vdIZGML5G1TFar1/t6zxjtm2ps0VrRSXCcOit1yIy7 HTjm+Ny8SrxqrHICY0ITpLVn1rZUphDkU33kjrNQdbGIWWYryIxWcpZhmo32eX8TvnBroVm vJMCk0W63UV2t84C2FEE2FxRL+xolJCfH7TphaqhFYMslEx0EO20nvUXtZckZGN+xtF0emx PcfQt7RLzXjlxApt7hh/w== X-UI-Out-Filterresults: notjunk:1; V01:K0:HTkuKeifFts=:/l7/itGFadjpZT/nVlxFLO IaodfMoauEJhDRvc2JikW7OCov6pLUmcwJFTLkehY0U6eNZgOHXMm2n1d69DISgDmgPJbKj1P t6jrbDhaPfQKQB36xeEMybGEEAhB5kortrjAYGICuDJjo8GRW52oaa5UNMEWLtdURz110SZEL qRnPSyuDfpf/v3goLoGGX6QvMtcLHtilKVYu05roVaZow+JlQxoS3DAhVlsGPKjkVjgchL5d8 7NgsCul9IhZAHIdfp7/coJfKLvbb99yV+4WnC9l49HibFfDZfJNfDKt8fH3zzFqEZCQ+vgR1y TdoAiep3BMSW1YGTN2aM1P93tmvyrYunTRqPE2OwdxSLhORRmroA3LFHblls7jNEYPqKe7T0S UPh51DcBXVxZPxV+NErysGqcUhn6S8EOr5Bf/AgwJPEpxFgmbJYcJOmy78murcnIuFS8byOcH BQfHZjLoYHn4Q7GNpZ4afHLiad0NvtRhpvy4p8Z+gnGCud/pDFnYNWXU7RJazMWgdAu0IEydC 1LtbtSflohNSoZ3Jhh5XRjnPs1uSolpEQ/PVTwQ3kadxmSUAXY7o950DAzjKQHTS91hXaYM3S CyvcFe0UpUDfNQvp+9MvPBGFpHi6CESlNcqXXMJkplRrcCWth1zjX2zLHZNczy4zqXc+6UfOf Y7K8fy94c+U91x6V4pgj1BOXXo40vIA3aiEY+v2lS6X66cHrf7cGq/9CwiWlbYRPiRh1hQ1r/ 0zjneJQe51M0Y49qDAmh/mByUiOiV1RCDETlO5FRosZmWVU7pHSX4Rx4/qSmr6QUlGFvxCbes qYg7Z72 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 From: Markus Elfring Date: Tue, 7 Feb 2017 20:06:31 +0100 * The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix the affected source code places. * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/hid/hid-debug.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index aafa963e8a04..444c63f0e4be 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -1083,12 +1083,15 @@ static int hid_debug_events_open(struct inode *inode, struct file *file) struct hid_debug_list *list; unsigned long flags; - if (!(list = kzalloc(sizeof(struct hid_debug_list), GFP_KERNEL))) { + list = kzalloc(sizeof(*list), GFP_KERNEL); + if (!list) { err = -ENOMEM; goto out; } - if (!(list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, GFP_KERNEL))) { + list->hid_debug_buf = kzalloc(sizeof(char) * HID_DEBUG_BUFSIZE, + GFP_KERNEL); + if (!list->hid_debug_buf) { err = -ENOMEM; kfree(list); goto out;