Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp794299imd; Sat, 3 Nov 2018 10:22:06 -0700 (PDT) X-Google-Smtp-Source: AJdET5dRMuM1wMyyQaHWNgYGYV622yqBPLLel01H1Vqg7S4uoUOmOo/JDSoZ7EYbHtiEcYHgQ3PJ X-Received: by 2002:a63:504d:: with SMTP id q13mr14958867pgl.319.1541265726770; Sat, 03 Nov 2018 10:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541265726; cv=none; d=google.com; s=arc-20160816; b=E6F1NqeIMq8qulsNC7DNp5fBiXP32+0W6QpoKJixI3A0Mqk24IkwithzRvUS49kPoq 9Sr91zrEd6leZWzw76Z5LfhRC9GGCqW79S6AzrjZw+UeflW430ayaYtkwUOX9jV3jhjy 1WclFXafrOxtSbmlGpLf6pP8I6/o/JVHOzGkAe5B2sbHxAq7RfRzpx5H9nnfdN1ckQ9d qB3XqY6kQYSDVXgDmmlBUBkPb93m5/hrRGkIc2l7NFyOXGL1e48tF5LaxOGdBgzzOgNV 0+7285V7DC11asVO0J3n3c89kio5SPC4L1L+zUA4AF77gwYCYzRh7s95B2OSrE/9TJoQ zOdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=d4C8rnYGvuBc1yHYoDIiIjLBX3Rc259RITrx/3gFTnI=; b=kuNM6RAlBdrAsM2Dd7v3GrsCuwWssOiCCSWFVCjgZZWNj6sShNk0pbs62gThG/TCrw YZ/Xi/T6Uk5k4HisDPJnCM0i2RouNgQw/WeIv6NiWdNOFfofuVPAhm9GxYvkHDVAg9mU mQNzsGKjUuDKQhZPRPXSgoUxlHd0aCB3/k25hUh/r0urZ/jVaBMLOY6vlR3vj/+GF+M+ Vvdb1/ySRRppBgUQ2v/s+ix+qYTjPpB/45+NqBB3ZSa8Jh6iXc3bIPTXJI33aBHqfCNe NzaTcYh3OA4Voa2XNSLqu5UnX+UuqtMc89XZ20WAPPRO41qxVhjB5V2H91GagrIf8gGu 4eSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kHAH4UGM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si40668454pfm.51.2018.11.03.10.21.51; Sat, 03 Nov 2018 10:22:06 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=kHAH4UGM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbeKDCdW (ORCPT + 99 others); Sat, 3 Nov 2018 22:33:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:36226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbeKDCdW (ORCPT ); Sat, 3 Nov 2018 22:33:22 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E684620833; Sat, 3 Nov 2018 17:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541265690; bh=HU06r3bRSe7zkc+tJM8e4O0v1IVSlqQAevS3gqArEuE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kHAH4UGMN+B1FnSFVRS3uKqeJ3jwDKx1ITiUJ07BLlCH0aQ6l5fY8dnnPUZvDCdM9 3z63PU13dpB1Myq1vjEDQ3rZuGn64wBWEfyL3Ac/J2jy4v+ouCxPByU2zys4bRrpgs Cp0QRr0dfO4d4K28g8syVDk0Vz+W2sUzQE+TwWhM= Date: Sat, 3 Nov 2018 17:21:25 +0000 From: Jonathan Cameron To: Renato Lui Geh Cc: "Ardelean, Alexandru" , "lars@metafoo.de" , "knaack.h@gmx.de" , "Hennerich, Michael" , "giuliano.belinassi@usp.br" , "pmeerw@pmeerw.net" , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "devel@driverdev.osuosl.org" , "kernel-usp@googlegroups.com" Subject: Re: [PATCH v3 2/3] staging: iio: ad7780: update voltage on read Message-ID: <20181103172125.40541052@archlinux> In-Reply-To: <20181103160618.wioq7jbdh4z5yqdw@renatolg> References: <1bc4bdf6342d4bc0c2fea17fb3bcd79fabf0e1d1.1541082656.git.renatogeh@gmail.com> <20181103131002.7956a08b@archlinux> <20181103160618.wioq7jbdh4z5yqdw@renatolg> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 3 Nov 2018 13:06:19 -0300 Renato Lui Geh wrote: > On Thu, 1 Nov 2018 15:20:55 +0000 > "Ardelean, Alexandru" wrote: > > > > This looks wrong. > > I admit this was done in the same way in the probe function, but that looks > > a bit wrong as well. > > > > Typically, the return value of `regulator_get_voltage()` would get checked > > with: > > > > ret = regulator_get_voltage(st->reg); > > if (ret < 0) > > return ret; > > *val = ret / 1000; > > > > So, negative values are errors and zero & positive values are valid voltage > > values. > > I see. So -EINVAL is only used when sent the wrong info type? yes. I actually misread what was there and thought we were just talking about using a ret variable rather than returning the error via your local variable. Definitely want to pass on the error from regulator_get_voltage as it may have more meaning than a simple -EINVAL. Thanks, Jonathan