Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp832955imd; Fri, 26 Oct 2018 19:01:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5ec+cnj0gkKyo+/n5FcZqOuhOms1oMRofTdJcUlbFAxgAa0Tf4SNfiWceC5HLkQfozlqrK/ X-Received: by 2002:a63:1d62:: with SMTP id d34-v6mr5781118pgm.180.1540605696654; Fri, 26 Oct 2018 19:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540605696; cv=none; d=google.com; s=arc-20160816; b=PxujxBv/bd9OY2ZbC84xn4enLHhO7Dkb3lK+pfh9DothYiHkNYnjCw4SodV5pUZ6Vx 6Q6biOFZBn72fbS+LiHUH0kQ5XUAoOroIlbg/kjsvU07CEDcP7ERjwfXd8laJ9xhGXRR NbYxL+pnZlTvHG9x/3C/Wj8m/LiRdeIzDil4YRV1UPjQjfBhtTAPDj6iy9kAJgu3SLFG iVjXvC7hf7jmjf1qVB8azbPUfqfLvoxsiJpO/oUnOmvyLEZYpu22wAglkadY8FP0wS7y Il6tsflQRGr7skDMrJPJ/C+Qdw8zUW7btisJldIizIuw80vYp5GWbxqTvZEmJQ4fcDm2 hpMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=NGr8UhZ9CwRomF1EVbg7fLmktxQjU3RFkveOlg5US54=; b=qxlzJ9doGw3J33g1RForP9qp024lfQr1t/UxWk/jmo+Ykcj4yQxjIL5jNur6gT17qm bKq/fcsbP0Xu31cVZaIA8pbcwPmvCpA2aEQ0A1hI5ombphoX/Nar1uX4+roFIYV4YyD5 9au8+uILK/A8WiUVg8ScLgcSO1mZA2YnaallZkTO0LEO26f5gF8d6PZ9ko5iUcaMHShz 8V3U1G9UHFr8Qqr8btEIqJ7mhY/lCXvD8/vUx6Gj14FoRF7eoqMprs8yWFUn2TL83el4 fEnLm3WROvqSWcsUPi9sXxvKLSXGMg29hAqTmC/kM9GzqhNcXcJtZDx8xtEP1lta+sry 4DKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=WjbK4B6P; 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 23-v6si4008785pfu.2.2018.10.26.19.01.10; Fri, 26 Oct 2018 19:01:36 -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=WjbK4B6P; 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 S1725892AbeJ0KkC (ORCPT + 99 others); Sat, 27 Oct 2018 06:40:02 -0400 Received: from mail-qk1-f193.google.com ([209.85.222.193]:39923 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727659AbeJ0KkB (ORCPT ); Sat, 27 Oct 2018 06:40:01 -0400 Received: by mail-qk1-f193.google.com with SMTP id e4so1844446qkh.6 for ; Fri, 26 Oct 2018 19:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp-br.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NGr8UhZ9CwRomF1EVbg7fLmktxQjU3RFkveOlg5US54=; b=WjbK4B6Pz9n82ZrdDfd6PM5GbCp+QQyg3yNP3mE7mKzlOXjeN844EOEYIK2yahjQ0o mVp8ZHWSiKqLhFU9dnqEusVrxdF5+JSSC859jT7UY984FUY0tflownWmlZ2cmc8CGs+S t5xXcLBtcYq4EXaVJKSzsERb14VLzX0FNpZm06WX2ReOxgJAS8HI744ZwIUCV4hU3YMZ Kn6aBih4w7SM2pRK7K3QsFWq5UKIh+IaTLkDvcXJ6o/iYJlFE2B0bogytJBkp9fhmehr NX5h0px7aJS0V+aFJ7EZpleD7VB0oBRmUpu2ebvwHrP4hrlF8Z2W8ht/UmcwhwFYFgH5 nsCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NGr8UhZ9CwRomF1EVbg7fLmktxQjU3RFkveOlg5US54=; b=KpW9T1pzsYhggK16zBs3s+ePl+s5AYX4lifdbTalHAHhKKc6mC3dysF3vJ6kMGHUsW v+TC6BseKFIks/01xU5mZQbPsQo+z3M+s0IlSsaL+gXBFAnn9SRz1Ew7XtgfBTG067JL fiG6y+8ppq6BA7oe2CTuRa608wWJpGuTSUSGjdGjkgW5DbSKB6en0mohcn4djXRlyDRv KiAx44vMZJc1+BjeXf2wK7CS1ktmf8Nne85l94rghpJMTMaxo4tzA99JXDpDk95aJ6ft qpode7Yjmr6kBCZNP0B3W7VEG53EgcQgZL1tlWN3LY6Hx9DRtdongPRT40+MektGT5Mz tdEg== X-Gm-Message-State: AGRZ1gIaX3CmmvBY1wWA07slUhloYZcJmQ8+koyzswOyV2/p69IlZIaH rM+p/9gGiruC5c1RXbR6GGChDw== X-Received: by 2002:a37:fa8:: with SMTP id 40mr5265581qkp.48.1540605641110; Fri, 26 Oct 2018 19:00:41 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::1]) by smtp.gmail.com with ESMTPSA id h67-v6sm8499777qkf.32.2018.10.26.19.00.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 19:00:40 -0700 (PDT) From: Matheus Tavares To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Hartmut Knaack , Peter Meerwald-Stadler , Greg Kroah-Hartman Cc: linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: [PATCH v2 2/6] staging:iio:ad2s90: Make probe handle spi_setup failure Date: Fri, 26 Oct 2018 23:00:01 -0300 Message-Id: <20181027020005.3140-3-matheus.bernardino@usp.br> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181027020005.3140-1-matheus.bernardino@usp.br> References: <20181027020005.3140-1-matheus.bernardino@usp.br> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; + } return 0; } -- 2.18.0