Received: by 10.223.164.202 with SMTP id h10csp46589wrb; Fri, 10 Nov 2017 02:19:21 -0800 (PST) X-Google-Smtp-Source: ABhQp+TNphZhBdaMSdX8/p5TQgoMQbKUeNPg4hbyTLsbEsH41wtR1fg14zOEc/LDoWw2QrwBxWof X-Received: by 10.159.211.4 with SMTP id bc4mr3798374plb.160.1510309161280; Fri, 10 Nov 2017 02:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510309161; cv=none; d=google.com; s=arc-20160816; b=NMCsB4xd2ia76CAjUTvuoPEHae6STPPyVqe1I7eYnLlTPSv6fC4ZY/hHpHb2MctMFh Hlz4pfSoQ7WKoLzX2Mt10wleMn82PWO248Cq9JnAyqIzvX+4Sfhorp3AV89JMXjo0ofY WhxckEWSMaxwBNAk7qTVOCFKEI9zpXTdflzD4v4c3VzGi/Mcmb3C7qNLct5mzFtxe3RB SAdGOEc1sZSkSysLGGDq3hqxvFMvU1M4SlKU7vn/uU7i5Q2deKHXyr712XAD+BiLgp6r PmM9t0uTtdc8ePggSRXjHg4x7xaBgW2LD5Sxyk4Ud3jzdKRVXlH7sT3KAGhzpYCDt2AX 3Tvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=HI0LoFhBxa1rT+zEGdROCWrfTO3dD4bPaVY/1TEvfz4=; b=zrY9QfddyD6bKCW4385lZyBZuIjaR8GoFyNo14sSTWbWyOPdwaUHKfqD9XE/I1wXcs wYj+9tFmMM2L8TewJFG6DYzRGs607t+79YVYN5gXuUKCa8wO497RIs4mQ4dWmf+KW1yL AqTmK/PZNbQEWgnmjjgA7ZzPI3jCDHBsAcpi7jcc4Irz8n91GlTjd7gSVq1E9njGEJtE 4uaM1QcgpNCK06B/RjtpkbWPiI4cBpdppajYI3KyIGJxnLHOOlyrqKwim0lqZ8j1zhyl ubmdn0SPGgZ5ozaxBrBvH+Vgbvz7U23HQ6WTbIOSrrJGzNbVXJApQoewDtQQsIgWayfL hROA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si9129271pfd.201.2017.11.10.02.19.10; Fri, 10 Nov 2017 02:19:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314AbdKJKSd (ORCPT + 81 others); Fri, 10 Nov 2017 05:18:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42132 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbdKJKSc (ORCPT ); Fri, 10 Nov 2017 05:18:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2172C81226; Fri, 10 Nov 2017 10:18:32 +0000 (UTC) Received: from mail.corp.redhat.com (ovpn-116-173.ams2.redhat.com [10.36.116.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5C0C6F45C; Fri, 10 Nov 2017 10:18:30 +0000 (UTC) Date: Fri, 10 Nov 2017 11:18:26 +0100 From: Benjamin Tissoires To: =?utf-8?Q?S=C3=A9bastien?= Szymanski Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Kosina , Julien Boibessot Subject: Re: [PATCH v2 3/3] HID: cp2112: fix broken gpio_direction_input callback Message-ID: <20171110101826.GS9728@mail.corp.redhat.com> References: <1510304503-30830-1-git-send-email-sebastien.szymanski@armadeus.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1510304503-30830-1-git-send-email-sebastien.szymanski@armadeus.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 10 Nov 2017 10:18:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Nov 10 2017 or thereabouts, Sébastien Szymanski wrote: > When everything goes smoothly, ret is set to 0 which makes the function > to return EIO error. > > Fixes: 8e9faa15469e ("HID: cp2112: fix gpio-callback error handling") > Signed-off-by: Sébastien Szymanski > --- > Changes in v2: > - rework error handling to have only one exit path as suggested by > Benjamin Tissoires Looks good to me now. Thanks for the respin: Reviewed-by: Benjamin Tissoires Cheers, Benjamin > > drivers/hid/hid-cp2112.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c > index 28e3c18..68cdc96 100644 > --- a/drivers/hid/hid-cp2112.c > +++ b/drivers/hid/hid-cp2112.c > @@ -196,6 +196,8 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) > HID_REQ_GET_REPORT); > if (ret != CP2112_GPIO_CONFIG_LENGTH) { > hid_err(hdev, "error requesting GPIO config: %d\n", ret); > + if (ret >= 0) > + ret = -EIO; > goto exit; > } > > @@ -205,8 +207,10 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) > ret = hid_hw_raw_request(hdev, CP2112_GPIO_CONFIG, buf, > CP2112_GPIO_CONFIG_LENGTH, HID_FEATURE_REPORT, > HID_REQ_SET_REPORT); > - if (ret < 0) { > + if (ret != CP2112_GPIO_CONFIG_LENGTH) { > hid_err(hdev, "error setting GPIO config: %d\n", ret); > + if (ret >= 0) > + ret = -EIO; > goto exit; > } > > @@ -214,7 +218,7 @@ static int cp2112_gpio_direction_input(struct gpio_chip *chip, unsigned offset) > > exit: > mutex_unlock(&dev->lock); > - return ret < 0 ? ret : -EIO; > + return ret; > } > > static void cp2112_gpio_set(struct gpio_chip *chip, unsigned offset, int value) > -- > 2.7.3 > From 1583339630821138389@xxx Mon Nov 06 17:45:40 +0000 2017 X-GM-THRID: 1582957135433209798 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread