Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp446771imd; Sat, 3 Nov 2018 03:47:40 -0700 (PDT) X-Google-Smtp-Source: AJdET5f41TsbHgm+R3HseJBgqusoC/GtUVrvqImtvFpkclQi7smdmKxc4snmJulMpZaNzbSxTIjw X-Received: by 2002:a17:902:7045:: with SMTP id h5-v6mr14910403plt.211.1541242060173; Sat, 03 Nov 2018 03:47:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541242060; cv=none; d=google.com; s=arc-20160816; b=JHYGW9s6tEf0/k00O8xbCjLy4wgKSXtopOOXtXOpWpYqvsKG0e+WKf6ArnbMHIk5D3 onssECslgDeg/aI6vssv2C350EHbZwBdjLD13mLAnn0eL0jwVueXm5P0cPnpM7WHRCER cO825Loxm3hO3b4j+1duWzCV/SAnOK0500E+VCpLEM/Qi7RDf42LHbDf+RJNMWMgNMPC 9LcakzjhtnA3JXrwNcIcG7ooQ6O9gPSwXY1Nfn29hc4KVxQ/Od1dRKpG0c6V8wq96vyL nlvx2q9/QtFgu+z8K/UO2z3UcHKPcgpIU5BNRL8o0Y0si2oB2MV995f3dChty0wLJzqb /gtw== 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=FTOtUMygW2nSFscCYt3XRoa/aRFAGdA+f9hRqAonxJA=; b=LjAqEQsWgc3yirZgEe3Rr4W96oJjQffckWyFucyoQa8svzkHgAV5kNyPZWn1IipSGJ jpMdeHXbq158KYfXQ78/Nom7Oa0a4YGglDjQF7uL/VgJ1LBI963eKomvNdVnlwID+1hj NU78UIbIpiCDBXfjZGY6yPO08ice1sGlsYeu7NVEYS4S3y6C38HdF4LUErxtDNRE98xi AUxL5uJVMSEAgq5LQ7t8q7pb+9ZJM6D3AzcICDPZUEfpty+m1MEbsGU1/y5zNRDIVAMR 7fEU63PXg5OwIN9t0jl/0H89eN2p+3oI2z3a4gmgX9mipQXFd1jIO6ZIsKXG5ko4C1D/ DKuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fshX1JsL; 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 m32-v6si36817254pld.229.2018.11.03.03.47.25; Sat, 03 Nov 2018 03:47:40 -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=fshX1JsL; 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 S1728337AbeKCT4K (ORCPT + 99 others); Sat, 3 Nov 2018 15:56:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:55884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727952AbeKCT4K (ORCPT ); Sat, 3 Nov 2018 15:56:10 -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 BCA312081D; Sat, 3 Nov 2018 10:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541241915; bh=ICPJuaustjcgPaNXsiCg8rAABPBDIDRRtVEheBzpQhY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=fshX1JsLeh8fPTYageaK50ALlG1upb5rNH0kDdQ5E1sWriObGCyiIQ6KmuPX14Vhk tZ4apwp/mxlcmMjPIhT4JFRNNJu81p66MknOCSZtLGnAwlLy7VD2mZIkGpHmTLWd0E HRNAhdX3m7pYkyLZvNAztsdSKUX7QdoOylGRiOCI= Date: Sat, 3 Nov 2018 10:45:11 +0000 From: Jonathan Cameron To: Matheus Tavares 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 Subject: Re: [PATCH v2 2/6] staging:iio:ad2s90: Make probe handle spi_setup failure Message-ID: <20181103104511.42d96448@archlinux> In-Reply-To: <7e9048ff-186f-0ed3-35fc-4e8ffa595c70@usp.br> References: <20181027020005.3140-1-matheus.bernardino@usp.br> <20181027020005.3140-3-matheus.bernardino@usp.br> <20181028164329.57162e06@archlinux> <7e9048ff-186f-0ed3-35fc-4e8ffa595c70@usp.br> 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 Fri, 2 Nov 2018 10:59:06 -0300 Matheus Tavares wrote: > 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? For this sort of comment I would put it in the main description. It wants to go in the git log for anyone who is looking at this patch in isolation sometime in the future. The stuff below the --- is usually version change things and other stuff we don't want in the log. > > 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? Comment would be nicer for this one I think rather than the noise in the actual code. Both would be acceptable though so which ever you prefer. Jonathan > > > Matheus. > > > > > > Jonathan > >> > >> return 0; > >> }