From patchwork Tue Apr 3 13:16:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10321055 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 DACA160532 for ; Tue, 3 Apr 2018 13:16:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9C7B28BBD for ; Tue, 3 Apr 2018 13:16:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDE4428BC0; Tue, 3 Apr 2018 13:16:41 +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 4B2DC28BBD for ; Tue, 3 Apr 2018 13:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932151AbeDCNQj (ORCPT ); Tue, 3 Apr 2018 09:16:39 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932162AbeDCNQj (ORCPT ); Tue, 3 Apr 2018 09:16:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F23AE406804F; Tue, 3 Apr 2018 13:16:38 +0000 (UTC) Received: from shalem.localdomain.com (unknown [10.36.118.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0002B7C30; Tue, 3 Apr 2018 13:16:35 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH 1/2] HID: i2c-hid: Move i2c_hid_acpi_pdata error reporting to inside the function Date: Tue, 3 Apr 2018 15:16:33 +0200 Message-Id: <20180403131634.13187-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 03 Apr 2018 13:16:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 03 Apr 2018 13:16:39 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'hdegoede@redhat.com' RCPT:'' 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 Log an error in all error paths of i2c_hid_acpi_pdata() instead of having the caller log a generic error. This is a preparation patch for allowing i2c_hid_acpi_pdata() to fail silently under certain conditions. Signed-off-by: Hans de Goede --- drivers/hid/i2c-hid/i2c-hid.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 7230243b94d3..0d210928a57e 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -873,13 +873,15 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, acpi_handle handle; handle = ACPI_HANDLE(&client->dev); - if (!handle || acpi_bus_get_device(handle, &adev)) + if (!handle || acpi_bus_get_device(handle, &adev)) { + dev_err(&client->dev, "Error could not get ACPI device\n"); return -ENODEV; + } obj = acpi_evaluate_dsm_typed(handle, &i2c_hid_guid, 1, 1, NULL, ACPI_TYPE_INTEGER); if (!obj) { - dev_err(&client->dev, "device _DSM execution failed\n"); + dev_err(&client->dev, "Error _DSM call to get HID descriptor address failed\n"); return -ENODEV; } @@ -994,11 +996,8 @@ static int i2c_hid_probe(struct i2c_client *client, goto err; } else if (!platform_data) { ret = i2c_hid_acpi_pdata(client, &ihid->pdata); - if (ret) { - dev_err(&client->dev, - "HID register address not provided\n"); + if (ret) goto err; - } } else { ihid->pdata = *platform_data; }