From patchwork Mon Feb 5 21:26:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10201853 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 74D14601A1 for ; Mon, 5 Feb 2018 21:26:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6307A288D8 for ; Mon, 5 Feb 2018 21:26:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53DCB288EB; Mon, 5 Feb 2018 21:26:28 +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 EBA04288D8 for ; Mon, 5 Feb 2018 21:26:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751992AbeBEV00 (ORCPT ); Mon, 5 Feb 2018 16:26:26 -0500 Received: from mout.web.de ([212.227.15.14]:57787 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751927AbeBEV0Z (ORCPT ); Mon, 5 Feb 2018 16:26:25 -0500 Received: from [192.168.1.2] ([92.227.235.192]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lhvko-1f5GmZ20Je-00n9r8; Mon, 05 Feb 2018 22:26:17 +0100 Subject: [PATCH 1/4] HID: logitech-dj: Delete an error message for a failed memory allocation in two functions From: SF Markus Elfring To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: LKML , kernel-janitors@vger.kernel.org References: <12e9f2fd-5e85-fe8b-5eec-cd1712b07166@users.sourceforge.net> Message-ID: <8c8c6986-9f72-4dfd-12f6-a530c4788398@users.sourceforge.net> Date: Mon, 5 Feb 2018 22:26:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <12e9f2fd-5e85-fe8b-5eec-cd1712b07166@users.sourceforge.net> Content-Language: en-US X-Provags-ID: V03:K0:KdZuRL/JUCKKfER/M+Gr4DtbbyYBBNSLXwxIv8EVh9o8dfvnCKF eaYyHTMtV+I9PJbykjRg5BGgOHIv4Ptkh81wqO3WmnS0TL6vK6/AKfAXxJfgMmA6Gyfgi2O 2xLTxeGcgdXquxgWarEUpB5p9Xw7O1h5YWf+96IEcmhH7kRUTcr4+HdX0OY8QuV/HgdHs9Z 1FscSi2d7eBIo1NYkFbzA== X-UI-Out-Filterresults: notjunk:1; V01:K0:zqbTRk1D4Uc=:DOEi8xu2202fIhao3pxu0z n+QMETl+JpWGu3onRWBt/MYQwzRkdzO5IZkgOl34UeTVeT4PhkLm/fTbCRBjmQjZc5S2ytBzS HQKlgI5WFEHsbIl2FwXyO85wT1zG/5F5EDoykctgrjxfdXk5LIHRtHqxDq+8IpmL1W4YCQMry 8LhaboiYAYQGOpGNnEolX1ixC42om5RvYVIySl7tAh6I2SmSpg80zj6ZwP21TesCjYKqk/nTv UZlZbCF6m/RlFjTk1zh3ZJgH5odFMz6aLINzDwsm3Vs+UBgprL4LJ/B3UfK4nfy9XpfEKG58U 6KMcWg4pROtvYExWh9qiv399ejVesiwDReYyRSXjJ5LCUN1ZMCYHRhZ2aw50bEqb0z0aYGo0Z z2oqGkbS6OhZcz7/2hNWjlvxcgg/s6oUQpkY8jXUdETQdXzO5O5Dz6eM5SO4BFbNBo8FcjPd1 utoEIGdHvLENCzbaqGiC2weMjggtGIjR+cgfHXuUb3C2ATUE2ufY/OvJVCSsEQB6qyyWo1HZe XvyKHt1zKHLAyJ0Gl0/DBJbq/DwsYx+caJCdamD6TnG/pqVoLT0GkRFDDefqtabcvGtlM6GkA SpmeQDLB56D1pk4C6gSI8FuwRIEjSBSBzpQHWLsh/v4v96N/VwwG8+41eKPTnMPi5C5+EEV8j Gh68OSxR+Q+kPwa7g1cIq/YARwTiyiQeP+Pmqgi53TAL/se/HYk9+vvmI/t0tfBO2EeSDY6TE ICKcvzZ3bpjDnBzVIveYmsyWTm1OhSTePP6/0fDbyldYqrKxTy/CGKR6dkzWRs/F1+zCVjbqf 8LLXSgr4dgDkQUWhvYuug2EiG7eSbi4PAlWldz90cCUel3GhEo= 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: Mon, 5 Feb 2018 21:36:18 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/hid/hid-logitech-dj.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 826fa1e1c8d9..4c92b2cb5768 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -418,12 +418,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, strlcat(dj_hiddev->phys, tmpstr, sizeof(dj_hiddev->phys)); dj_dev = kzalloc(sizeof(struct dj_device), GFP_KERNEL); - - if (!dj_dev) { - dev_err(&djrcv_hdev->dev, "%s: failed allocating dj_device\n", - __func__); + if (!dj_dev) goto dj_device_allocate_fail; - } dj_dev->reports_supported = get_unaligned_le32( dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE); @@ -1011,11 +1007,9 @@ static int logi_dj_probe(struct hid_device *hdev, /* Treat interface 2 */ djrcv_dev = kzalloc(sizeof(struct dj_receiver_dev), GFP_KERNEL); - if (!djrcv_dev) { - dev_err(&hdev->dev, - "%s:failed allocating dj_receiver_dev\n", __func__); + if (!djrcv_dev) return -ENOMEM; - } + djrcv_dev->hdev = hdev; INIT_WORK(&djrcv_dev->work, delayedwork_callback); spin_lock_init(&djrcv_dev->lock);