Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp165854ima; Thu, 25 Oct 2018 17:46:17 -0700 (PDT) X-Google-Smtp-Source: AJdET5ejetHwT236WuvbXkTICpEZCF3wNxsr5y56VxP+vzawABFWiLrXcFaWiT4v3Ly1p3dDqRZi X-Received: by 2002:a62:5547:: with SMTP id j68-v6mr1444722pfb.166.1540514777048; Thu, 25 Oct 2018 17:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540514777; cv=none; d=google.com; s=arc-20160816; b=wUr+/tnfsjSnqE4BGmM1GHiw4jt6eiX7c9+srWZpCgX7CCzLGtAVWgrhepD98aLhmV gMaNrxIkZs4pRZKMZJ6ck175i3fBSbUJPumbxcfS9j0EN2S2PphkCu8MIHNQUl8BkPr7 uJ5kvWSTLgP2NTJWv4BT+DBdWzhhMLiQJ0vM77ud+aJ77id2BZQdVwQmrwN0oKykquve Ke3jBrne4JSMpfQVLQ1ZAP7Drip5uecUN9uEQDB2sN7s7wGtzNZn2NGUYiABmgTS+RfS /FQazOj1pUStQL5w9tHT9ZOmLWG5+/9/n1symSedGyGEfEOSqQ5AKT6BInOVbA931Tj4 huig== 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=mrizKQyl/dnts4cPIRlr4qHW+9lS+fPPqlE9e1ZZ80OcwefUBUQKx6tT+VORnvRVoC clGUFt9dgk3g+aapXTUEs0Y1vQMkHRK3tpS8ixzlK4gpHGOX3n9bWZDKQnYA7X4+DJgy AtuaddW2LXwjWBuGVtOySqIMDKcGGuA5lhYpFe8hqbTG5MV4YOrThPcL2/hCP2keAccg +RRKlZ+YiQtWe+p/fO60Qpyer4XN3AXczsYDJBLwc1ziY67Zx7Q4NDMjxVmrOeRfxZep wN4UfnWK1jFX3HB3DmvFB113sGyYSvanrXHFZtXC8AvQNwh0lSUPAkQK0Oggi9GXrqHd k9hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=rOKyx10R; 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 f59-v6si9826667plf.409.2018.10.25.17.46.01; Thu, 25 Oct 2018 17:46:17 -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=rOKyx10R; 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 S1726458AbeJZJUV (ORCPT + 99 others); Fri, 26 Oct 2018 05:20:21 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:34006 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726367AbeJZJUU (ORCPT ); Fri, 26 Oct 2018 05:20:20 -0400 Received: by mail-qt1-f196.google.com with SMTP id z2-v6so12234005qts.1 for ; Thu, 25 Oct 2018 17:45:30 -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=rOKyx10RBKfSqOFtomhH6h1F9pCvFTdlBHfhpdYPitYnjM4w60pTYS/+VVgnO8GPh6 8lpYdCvbst88qyJ+GA0Jo6R/J3zlsy8i6cu/bmUJa1ajX/J/vx4IWlAS/FANAlcrIlqb Ok/fzUl8pNPLLHPj+XmhxzpO44mvJRSxspzN/ZzErOOw7XnS7OqukMveU5xxbyXl1aBI i6DiyO5ILy8uqyx8X7t9+bDP332/wI0uUzXllGxKQ4H9mDHzNLqMC+nudw/F3YY2R5ll HfP5f7dEGRrzdmG9J8itw9tb6Tpoz45Fk/mAy/OMfNVY2Rj9Furwd97Tpj2zquNldt8b TH+w== 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=YKcpnQFHMNN3IQawPHRg0Iy6fJCR7ilc2g+D6OD2pgtbqxYNk9hvvoh8mekQd28bHY HnjYyVCiPPKTIk/4WFzfOkSMEzZmC87F8sTra9V84pxzweBkHswM4R8Kf2r1OmNkgYG/ IZN4syRQDB0KNTxiDD8IU1nhxYUv09cem9bLF5oMtnVrrHsq625/rQubrPjvxO5Q4vQN zDNq/sgVZrXTJzk0gAcY1amleTJknBw8GcS0MGF2a4egy9anwtBKxPAaxabQRHKTX+t6 XqADINKPTDp3zjRxk+XnytgsYeUNJsOor3dZwjr5gUpRKXZakqn0Q6Gutx0X3ztzaL3o 3g/Q== X-Gm-Message-State: AGRZ1gJlYo68K95wDQJX4Re/NfRw5txj9vIL6h+iACnLdZJ3+A++/3Og NogRpQUwE5508Cb/cdOxggHq1w== X-Received: by 2002:aed:3b4b:: with SMTP id q11-v6mr1333973qte.229.1540514729837; Thu, 25 Oct 2018 17:45:29 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::1]) by smtp.gmail.com with ESMTPSA id y3-v6sm2371735qti.27.2018.10.25.17.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 17:45:29 -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 2/6] staging:iio:ad2s90: Make probe handle spi_setup failure Date: Thu, 25 Oct 2018 21:45:08 -0300 Message-Id: <20181026004512.31012-3-matheus.bernardino@usp.br> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181026004512.31012-1-matheus.bernardino@usp.br> References: <20181026004512.31012-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