Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2159913imd; Fri, 2 Nov 2018 06:59:52 -0700 (PDT) X-Google-Smtp-Source: AJdET5dTY0+6t3VWIbsbfCFkQ7bTDeLuam7yCOublWevbpNPeSFe8RmU8VHfrBn5OiOlOtW+IO8D X-Received: by 2002:a63:ea43:: with SMTP id l3-v6mr11130995pgk.427.1541167192637; Fri, 02 Nov 2018 06:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541167192; cv=none; d=google.com; s=arc-20160816; b=0KLIW3bt8sBWCQngx3+ieD2AljumVfjIzUCyneGq34EguK2PTxg6K/b7B3OXVjbbin G887mWhXM0nSylJaahxevubeDbQ4U2kYoKb6MPyjxvMWD2lW+E10W2AVPWW1Stk23yrB cf9MUp21m64462UGw6cdccm2h+K1PV6YETf2F7CbrxKgbkEa6OWVg9KUaAwASmuH3B3j 7F0JXRdAw+oxiVgjx8sAc2bKGu+qBW1gbnTIhKi5vdTNTUfjBY+HBgD+5ZUaGtgGsZgY SncGGgrcrB+a0aE5w82eeKH2bGeNGsSVhP4ZuRZwJ/R71l4T14zF5+atPcm1rTqfBwQw jRRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Bu+1Q9WrSOolr2QdaaXsuJYRQhCHIei9+2ATMxVv2wM=; b=us/lmIOKOMsetjbR83vt5DU2TSkKLp1WLbLAX245Ai71tmj/5p0omlso5IeQPBVFe1 /nHgDrkdi6mACcz4D4luGlArfsEE3bp4rw1Wikh6en2xw2rzkbeS+ET1O4A5KuMtrQBZ gLmkrKUIFHZfQoLvSpg1uGon/EzVpT2Tn/O2bHqnVeC6M0AF/s6cRsigpdZT/5Q7NYRL rZ72Y1394h+FnX4EXRfENMhnd25OMKw9OqSi5KRgUuJQxwHYuW2slUvmWMSSwOLyk+2J ZJmocb2bgg2i8OGJkZ6jNA3cN8DDhUT7If50ZmdCV4BoQBgQCeP8g2o+YKZRJBohpZnG QsKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=wExw2RfW; 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=usp.br Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n32si7444043pgm.439.2018.11.02.06.59.37; Fri, 02 Nov 2018 06:59:52 -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=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=wExw2RfW; 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=usp.br Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727828AbeKBXG2 (ORCPT + 99 others); Fri, 2 Nov 2018 19:06:28 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:45342 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbeKBXG1 (ORCPT ); Fri, 2 Nov 2018 19:06:27 -0400 Received: by mail-qk1-f195.google.com with SMTP id d135so3078534qkc.12 for ; Fri, 02 Nov 2018 06:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=Bu+1Q9WrSOolr2QdaaXsuJYRQhCHIei9+2ATMxVv2wM=; b=wExw2RfWLLR2QkB+OTes1WlzhhZZDAr8HYRym8Sck7FOBvIyrcCLfS2b/6L93ONq0W AODXtVl5HDiC4Urh81/BsJJ0x58KDgRodVW4jMl3S84QBWnw76CWuAsNzJ8Gyw2GHDHT iKpl+YkVxA3FYPRnLLRQF1MBxJnlcHlorDOi+a2i3TaxP+h8JTJ5H0WdW8KEu6ScjvPL YxSGk2olirqTqp24VOxExVaO8+iXJ319L7oJS3+8aslUHy8qCsL3NmrxD2/jFLqSydrZ uKiZoeRVTjE0LjXlv/RzMs1dvHjrUkpM9+RyIs6vYRWX9r+QtliCfAu8vxQIhbgiIxGN RCfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Bu+1Q9WrSOolr2QdaaXsuJYRQhCHIei9+2ATMxVv2wM=; b=f36lZw3usAoI/AOSmxQaN7J+1qBfZjgIxFnj+AyBh669UNx5p9w5EH14MTKCl0M6SV hQz+qHwKwuDF8kjTDEMDRWIKuwqOz6S7D6Ny714LYFy/USdYWw874ucUHYzWRyeGRdag z3ndLTERqnj27nUd9gnDxaz7eAKCLEjgCb9BR2zAFPi7j01yZgSNQ7PL4uvGHfIp1Q6F vXlcIgdCOD/z33LaEarLmZSiah8bj65MNh1wsj9cCVQpBy/A9OD/XyUJ2Bhk7kaZwXto Gu1iou+qp9CX++Nz8t1KWrGR3HduEZGXQT/PhPJBmOVhe7N6o8PQ1DrTcRBVZ8Y94Tg3 FvGw== X-Gm-Message-State: AGRZ1gLDXV1Q6CaH09bq89C+lxgZApdnAzbcEoAHSkZT42dN//+oPOWP j2ltYFmtn1A6lSwlCNeOTCz+Ww== X-Received: by 2002:a37:404d:: with SMTP id n74-v6mr10936333qka.312.1541167152558; Fri, 02 Nov 2018 06:59:12 -0700 (PDT) Received: from ?IPv6:2804:14c:81:942d::1? ([2804:14c:81:942d::1]) by smtp.gmail.com with ESMTPSA id 35-v6sm24226632qtu.69.2018.11.02.06.59.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Nov 2018 06:59:11 -0700 (PDT) Subject: Re: [PATCH v2 2/6] staging:iio:ad2s90: Make probe handle spi_setup failure To: Jonathan Cameron Cc: Lars-Peter Clausen , Michael Hennerich , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com References: <20181027020005.3140-1-matheus.bernardino@usp.br> <20181027020005.3140-3-matheus.bernardino@usp.br> <20181028164329.57162e06@archlinux> From: Matheus Tavares Message-ID: <7e9048ff-186f-0ed3-35fc-4e8ffa595c70@usp.br> Date: Fri, 2 Nov 2018 10:59:06 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181028164329.57162e06@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/28/18 1:43 PM, Jonathan Cameron wrote: > On Fri, 26 Oct 2018 23:00:01 -0300 > Matheus Tavares wrote: > >> Previously, ad2s90_probe ignored the return code from spi_setup, not >> handling its possible failure. This patch makes ad2s90_probe check if >> the code is an error code and, if so, do the following: >> >> - Call dev_err with an appropriate error message. >> - Return the spi_setup's error code, aborting the execution of the >> rest of the function. >> >> Signed-off-by: Matheus Tavares >> --- >> drivers/staging/iio/resolver/ad2s90.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c >> index 11fac9f90148..d6a42e3f1bd8 100644 >> --- a/drivers/staging/iio/resolver/ad2s90.c >> +++ b/drivers/staging/iio/resolver/ad2s90.c >> @@ -88,7 +88,12 @@ static int ad2s90_probe(struct spi_device *spi) >> /* need 600ns between CS and the first falling edge of SCLK */ >> spi->max_speed_hz = 830000; >> spi->mode = SPI_MODE_3; >> - spi_setup(spi); >> + ret = spi_setup(spi); >> + >> + if (ret < 0) { >> + dev_err(&spi->dev, "spi_setup failed!\n"); >> + return ret; >> + } > I would have reordered this first to be before the iio_device_register call. > The reason being that it would avoid this comment. > > Drop the return ret out of the block above and return ret unconditionally. > > I don't mind too much as I know this is moving later, but I only know that > because of the earlier discussion ;) Few reviewers read the whole patch > set before responding to the early patches - it's just too much like hard > work. So if you can do things in an order that minimizes standard responses > then that's great. > > Patch is fine though - could be solved by a comment in the intro that > says the code in question will move in patch X. Ok! As a newcomer I'm not sure about the right way to add this comment. Should I add it to the patch message or after the --- ? Also, how do I reference patch X? Just giving the number of the patch in this series? An alternative to adding the comment would be to drop the return ret, and reinsert it in the next patch. Dosen't seem so good, to me, but would avoid the problem you presented. What would be better? Matheus. > > Jonathan >> >> return 0; >> }