From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755348AbdBGUEU (ORCPT ); Tue, 7 Feb 2017 15:04:20 -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 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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.11.1