From patchwork Tue Feb 7 19:51:37 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: 9560995 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 233E260236 for ; Tue, 7 Feb 2017 19:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15ACC2847C for ; Tue, 7 Feb 2017 19:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09B9928487; Tue, 7 Feb 2017 19:51:58 +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 A0B5D2847C for ; Tue, 7 Feb 2017 19:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754690AbdBGTv4 (ORCPT ); Tue, 7 Feb 2017 14:51:56 -0500 Received: from mout.web.de ([217.72.192.78]:49584 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752885AbdBGTvz (ORCPT ); Tue, 7 Feb 2017 14:51:55 -0500 Received: from [192.168.1.2] ([78.49.4.3]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MNtTz-1cULF20iUd-007Xl9; Tue, 07 Feb 2017 20:51:47 +0100 Subject: [PATCH 09/18] HID: Return an error code only as a constant in hid_allocate_device() 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: <58187414-2ced-17cb-cb6a-0fe87d0e5fac@users.sourceforge.net> Date: Tue, 7 Feb 2017 20:51:37 +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:8aSSDHnQ39BKMIPM6MrU9/Bl4k4mpz9JTVZh00LAX2nnfOLh6De B7efab5JXwhqNeVZdw0ZCgmdR4W+raFVLIWAcvIHb1UGiS6J5/9ewYASygo6CHgSuyLEZm+ tRRmR3A270OevwRwSYNZCoAsqzOXw4+RQGGyG3xxfkJ1zPeqfumcAY8RAmuytAESEbpPQiJ Hlgua0bytFeQVsf8+Wpmg== X-UI-Out-Filterresults: notjunk:1; V01:K0:hRXVCzrXfkI=:r89yaBsRgbhwWeFk8q3tHv qPkqbxRLuQIOqET8cjpFRVMPldVg9hDmaWAK9/rP8mOqpAmpNUJWN1Ufo1EwIOBy7MjNZ9VLY rpEYCtsaLvkWCXf8MgmHHFvY2Hdf6u6H2zVD4MIk5Qy40Wucg+MfOsxihDOkk9EsAGkMyGrqO 49Os4tpwpw0RPgVx5StKWByV+fP46GWB6SzczAFAzYta2Y4EUGxFb1wZ1aKcRchvh5i+3rr28 die6drRcDlynpXpGegpxY8pWoMqRKyVDEZI6IStdkGzkvopySJf7angF9iSw/R8wEXmnUy7tV ymu1AcvnD2C2WtGFJK7DfOB1CSsTe9Y+0JL8yt2yS9GnCiZrJsBuvmA0RcDcfi0H2BEZTB2NN JrMpuelo3BGdhHvPbyTMa9EGYdq0IxX219U1qtbNt6hZaSGxSOdVB2OVis8Up2zYfYNnlRyQF HqGSXofOPMjTn8rYADdAc410aETkRgR2djfxcek7NBGXGoThvNBkA4sBzBrvV7yKCfuQ4xJGq bz1yVV1JMrB1OzQDvCwkUf/tTNhxJKQITIkYtg03CvbZNjipSIRVdRa/kqtLgnM1T+3Trh6vK fXRQgnQqJUP2/gKny33tBPfFsFZRDyhBgbzCuop038j1E+tOhW31qaeceJzMYHmOfOCJK3gx0 a30U2xFP1Vm0ima150lco3T8eKbobo+wXFQBLAw4DZ74gQhxGjY3QeEt05QTYJZjCWVEX/5Sh 8c3wAy+58l2q82Acq+WpYdI9C3N4nbvWngYjYdfjUuwRBjoPtjL5kwKvk7rgy+h76UGekcrdt rG87DEx 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 19:17:36 +0100 * Return an error code without storing it in an intermediate variable. * Delete the local variable "ret" which became unnecessary with this refactoring. Signed-off-by: Markus Elfring --- drivers/hid/hid-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f4ea3590954c..a5db000ed1c4 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2716,11 +2716,10 @@ EXPORT_SYMBOL_GPL(hid_add_device); struct hid_device *hid_allocate_device(void) { struct hid_device *hdev; - int ret = -ENOMEM; hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); if (!hdev) - return ERR_PTR(ret); + return ERR_PTR(-ENOMEM); device_initialize(&hdev->dev); hdev->dev.release = hid_device_release;