Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1020650imd; Sat, 3 Nov 2018 15:50:56 -0700 (PDT) X-Google-Smtp-Source: AJdET5eowY0TiBZUXxY1VatYhp4fdBBk+EwVZjOwH3sl28ZqS/0c+5+KotmCR12trCLoytYl2wez X-Received: by 2002:a63:5d55:: with SMTP id o21mr1485559pgm.92.1541285456671; Sat, 03 Nov 2018 15:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541285456; cv=none; d=google.com; s=arc-20160816; b=oqvvHy63B/m6NKR/xviYLmkwjTjyG/W+ta9IWZu/HdSeri+qndlhmb5UwwG9UQM1U8 u/pZiHsG1pWZBlQuYZxTkxEZLGDXiPrNsS6LoKJSxLAMbT434+Ilijhh/16oEvJs2Ljy cKFIUhVmgQUJGWmA2JTzs1bCXSbs2aymaWFFkaHaVJXaVXOdb4u9EzpLj6OHzwEPU+sz 0wipGsa7M6zuHCssfIjummAHlv5JbDhxeuFhxWtaoS9YSyNjQT374hrxpPB/6+R3TFZq 7RG6U5tmQl4EwYKovtR9LTExxYrtmfgOHIckawROkNC8aXJ2RHRpjw/rR5CdJRQnreBN SFEQ== 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=9WTEEyu2PskGPSxUGKrtAjHaKSrp/L3vMKzLiu3cbGg=; b=GdqaG2MGc5iz2m4gUSBKVTsPJmkkuLcdq4xwA14qSfsAGRW61urdaTY0QNDqsfxZTt E6VXm18TZf/WXrBhR1FAH3XYvGvs2qZFdFYyG9YJm+/egJZNLUM3CChwLO7EOsKsRYTP 6r3oG1DZBN4CocmFM3jfERhda8pHuNiqR8yZwf2cT7aOomfDjDM/wSmLUWZgCudcbyYK yfYStPRTveT7caPXzd7B0s+pzFd/qcpp3Ga+Pv65vJwowSIjzhvBmI5p01NYHPxi+R2K M0KmY66fdI5VIyCfK3vhsvl5mJf5MUTrr/N6SRrmUhS6SH4RBavxjIq065hk9oVFrHU+ WFRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=r5r9RgfV; 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 m6-v6si40804496pfg.282.2018.11.03.15.50.41; Sat, 03 Nov 2018 15:50:56 -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=r5r9RgfV; 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 S1728662AbeKDICu (ORCPT + 99 others); Sun, 4 Nov 2018 03:02:50 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:38776 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728593AbeKDICt (ORCPT ); Sun, 4 Nov 2018 03:02:49 -0500 Received: by mail-qk1-f194.google.com with SMTP id d19so8974172qkg.5 for ; Sat, 03 Nov 2018 15:50:08 -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=9WTEEyu2PskGPSxUGKrtAjHaKSrp/L3vMKzLiu3cbGg=; b=r5r9RgfVxE21mp07NnNDnSYmc6exBER3fT82vmtGer3obqxsAA1Pm94nglHJIq1MTw D46w5ApH2CDU3qCxWI59fOQlx6o3zCD1dGNYYABvJAkmd6jqhcDKg6HV7zYL79FtRjku Z8hYvcgpBi8k5pgOc4rr+ypvrLXmcvLCPnvX5BhaJbgpMeZurei5OxmY/oiur6wU9GhO cOPcsM32d+/lbcFWlVV0137YVxI6RbHnFOIHrCyPnT637BI1mI6nkAJidTCQzy19elCa M2TWwPksokgvHpDirk8UylaOmkGVXIqa5IaPaGqLoiuRDQ2rbWnMyfdwCBoRVKKLvLHC +mSg== 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=9WTEEyu2PskGPSxUGKrtAjHaKSrp/L3vMKzLiu3cbGg=; b=Ti865JeTM1hU2H4ou5Ag7GnnE1N5sEVGoInoHCBAnrMIJ2/YLG5EGjmZ+zlZkpN7Ff U5yNLEcoQAJ93K13Maj+fKaCBRNadZij5RIgaWBpsl7yE+A7IK1B4ve4hkf3fLAO0yRn BP5gRf6EQjl3w5pgWtoy6/xBpxATMsgiE5YUqCMJbVVekGSMeWNjL8iQuGTpIQncOWsE tiUROLqcddPFgX/geNzYkIhcLXUOSnBOq/y07/ML5063XyOqwgyNaRh4jEE6zbJrRwef AINjd2FhzVBW1/KUXBQzaPsfqSfdbac4qFFrkHWjhYU8ZnYs6XHhQQ3VG7cez3fWEu93 +lFw== X-Gm-Message-State: AGRZ1gKg6vSbX6L+qPV3qAwiAzkI1iWc2qRmoFAnqzl3oBwNmprjO4zO xHC8ur8fDoi65qtICjQeHu7PBw== X-Received: by 2002:a37:a3c6:: with SMTP id m189mr15557224qke.173.1541285408393; Sat, 03 Nov 2018 15:50:08 -0700 (PDT) Received: from mango.spo.virtua.com.br ([2804:14c:81:942d::1]) by smtp.gmail.com with ESMTPSA id 35-v6sm27550924qtu.69.2018.11.03.15.50.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Nov 2018 15:50:07 -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 v3 1/6] staging:iio:ad2s90: Make read_raw return spi_read's error code Date: Sat, 3 Nov 2018 19:49:43 -0300 Message-Id: <20181103224948.31014-2-matheus.bernardino@usp.br> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181103224948.31014-1-matheus.bernardino@usp.br> References: <20181103224948.31014-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, when spi_read returned an error code inside ad2s90_read_raw, the code was ignored and IIO_VAL_INT was returned. This patch makes the function return the error code returned by spi_read when it fails. Signed-off-by: Matheus Tavares --- drivers/staging/iio/resolver/ad2s90.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c index 59586947a936..ba55de29ef36 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -36,11 +36,12 @@ static int ad2s90_read_raw(struct iio_dev *indio_dev, mutex_lock(&st->lock); ret = spi_read(st->sdev, st->rx, 2); - if (ret) - goto error_ret; + if (ret < 0) { + mutex_unlock(&st->lock); + return ret; + } *val = (((u16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); -error_ret: mutex_unlock(&st->lock); return IIO_VAL_INT; -- 2.18.0