Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966101AbdDSQV3 (ORCPT ); Wed, 19 Apr 2017 12:21:29 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:33786 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965756AbdDSQVV (ORCPT ); Wed, 19 Apr 2017 12:21:21 -0400 MIME-Version: 1.0 In-Reply-To: <20170409135608.15621-2-carlo@caione.org> References: <20170409135608.15621-1-carlo@caione.org> <20170409135608.15621-2-carlo@caione.org> From: Andy Shevchenko Date: Wed, 19 Apr 2017 19:21:20 +0300 Message-ID: Subject: Re: [PATCH 1/2] hp-wmi: Fix error value for hp_wmi_tablet_state To: Carlo Caione Cc: "dvhart@infradead.org" , Andy Shevchenko , Platform Driver , "linux-kernel@vger.kernel.org" , linux@endlessm.com, Carlo Caione Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 718 Lines: 24 On Sun, Apr 9, 2017 at 4:56 PM, Carlo Caione wrote: > From: Carlo Caione > > hp_wmi_tablet_state() fails to return the correct error code when > hp_wmi_perform_query() returns the HP WMI query specific error code > that is a positive value. > int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, &state, > sizeof(state), sizeof(state)); > if (ret) > - return ret; > + return -EINVAL; Shouldn't be something like if (ret) return ret < 0 ? ret : -EINVAL; Looking into the code it looks like it may return all possible values: 0, negative, positive. -- With Best Regards, Andy Shevchenko