Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp166083ima; Thu, 25 Oct 2018 17:46:37 -0700 (PDT) X-Google-Smtp-Source: AJdET5ftK9SSRwjnsrNhcud1SNFoloSlJDNXO5RyAsPs+ADrnUajYobHD3X5nPomsh60FtWki04a X-Received: by 2002:a63:5726:: with SMTP id l38-v6mr1367946pgb.118.1540514797221; Thu, 25 Oct 2018 17:46:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540514797; cv=none; d=google.com; s=arc-20160816; b=GChUn2Q1YkgBQPfaDJ6yXavmWOIdoHZHa08t71veAQD0OaDZ0Uqp6YpJIkgUP+m9Ju rvpWujHbRis7Rtv2vktDZlbBd+uloK/Z8gWvyT3oMRWgEAnOd9AkZjk6OWGBD6x71siP sGPvc4N4aYcKZUkkxIuW4R6rHvesCHLl1J2mXrP7iN0cZ+8YJp+FC1RbrsTzG1RIEU5i jPvZ2pKLEnojgVix11nh+UthFuHekXvamtFsqVlY92yA/kUg9e9DAyqvGmbkZSAPN56q wiDXNyyQGNLMW0bthZG9YtPBtInQsZH9Q6UbFmR95gHqX5Vls7XFtesOde6ZmlJOK0Gf Rv8w== 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=k98qfZFTnS8YJsoHEehtGRqClwouswNGYRpoM+jy0g0=; b=C/a1WUH3EEHesFYULhX9+uPGRwXt5NemXHmXm+nMWHfGo9XCk5ulAHtfWEg42ty+zg mgQD0WXXxOyJrL50VfBJ82ihNj+TL25ERNNod1CPG+4VXtNjFdmZRkm1ED/+gftNRIUn 6b8qOM7CymtdKM2roehCVVyYjDjrNTXo8zdFo4z4vryjaTKnvLEtpqpubM3GvVMa0cyE RlO9LjBXrJSgLBj1z44qC2hvWodC4tO5esIIaXGp/I7CT47/u+5C5wpw+hjAryl5/lVl qwyWtAlE+swLAC/55DcS3mzrUNDHFUXKptT7jyhb0Ps8swlTRWovjaEOIwvTXJwwx23I h+MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=WfCe3OEf; 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 m14-v6si10367439pgd.282.2018.10.25.17.46.21; Thu, 25 Oct 2018 17:46:37 -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=WfCe3OEf; 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 S1726291AbeJZJUS (ORCPT + 99 others); Fri, 26 Oct 2018 05:20:18 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:33998 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbeJZJUR (ORCPT ); Fri, 26 Oct 2018 05:20:17 -0400 Received: by mail-qt1-f193.google.com with SMTP id z2-v6so12233902qts.1 for ; Thu, 25 Oct 2018 17:45:27 -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=k98qfZFTnS8YJsoHEehtGRqClwouswNGYRpoM+jy0g0=; b=WfCe3OEfI5h5TiyKZsUsPEW2ZKcSFLs7dwNQWaIFKq66ADuDggB/mQcSdWhrtg+mUd nXLELbHh2LuH2DsgCXMmPv1OfsjauU70IQWSz0OnSTxjisc4ZmosHus0Nvnbt+ktMMUl pDzz/9wgNySKhry6SU46DAvPxZQMH7YF+PvOjZIuFDlbavhM79P8chxr9ZMUX5GbnFRq 4yHKooNi8IqMfMxz1I8mhHt9cYA5zo58fyVfiaSlzJJ4t3/m2BDlTp4EdNWQTw3Bv/Ci ABN8Vwi+jOKAdAZo7DqWNd2piS5ntdYePWUWi9mCDYdqThPpPUrn3pujlv67tGTWoEh3 vd6g== 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=k98qfZFTnS8YJsoHEehtGRqClwouswNGYRpoM+jy0g0=; b=mQqeaBwj+Gvvp8LSfvHoMv32xJSqas1SV8Xk9e9SdMSORUkSpdXGNC80oEbZGveIhj NYe95Y1DWmuLfixIOjNFvt2Kuhmdq3qw8JzAv/JH8ts3s8YG4i26eCDaJ/s69QJDIBD5 mhN0pSTj3fdWP3n/YFGQyFO7bAKNsHauP5MYz6mGBB7LWyFKQGbNDMhvieWOE+lUh55r adgFo7pEPY4ipgfAo4Y7m2ZuRKzgMIFSiTmGLldoDBgVGVsOibv0KyHHAr3PdcgQRBbY Cs/+h7zrbwzYgYLRiZMsW4wAouHzscEjasThl7XLaotdvfgxq3Po8C2Fi7Y87//x0sOO tMIw== X-Gm-Message-State: AGRZ1gJjfOaFKKD30MXFPm1GAncl32Mrs6VzbeiAY6/2VvKtZh0CqGIo 7hLSUxRijPtxiHi+wAjNPxNz3w== X-Received: by 2002:ac8:1b58:: with SMTP id p24-v6mr1364608qtk.56.1540514727014; Thu, 25 Oct 2018 17:45:27 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 17:45:26 -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 1/6] staging:iio:ad2s90: Make read_raw return spi_read's error code Date: Thu, 25 Oct 2018 21:45:07 -0300 Message-Id: <20181026004512.31012-2-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, 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c index 59586947a936..11fac9f90148 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -35,12 +35,15 @@ static int ad2s90_read_raw(struct iio_dev *indio_dev, struct ad2s90_state *st = iio_priv(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