Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp832953imd; Fri, 26 Oct 2018 19:01:36 -0700 (PDT) X-Google-Smtp-Source: AJdET5cHKRSENOHNCN2QO/cj/8R5PsheXi4ORikHBaf5BaV6vRDWCQNt22U06nkyAGnj7w1Mx9iI X-Received: by 2002:a63:d849:: with SMTP id k9-v6mr5567337pgj.200.1540605696634; 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=Tiqx0i2CCSX2p7GHuktCqluYR79qwP5umHY5aeE5HV7EgCsrGbF+wEfk6WndphEI+j CyKm4zdBkxVYaKLIc0j0rGG5uNGyv+Fem8tKZ+vT2+RhXoY5jpzdC+jAchCNkn/uFAPz UrPUlWeYs+qyphcL+dynVSEALW0rSH4mf+3Y4QzNX5xt5YJg7CsZT6mAoXZUqSupEMJn XE6vEGJHWkjl9UMyFsJpsdSNfmC+d76CMB8xiwuvbJ2Cax18h+i/hLguLUgrwMYTL5OY JY6OhySeASaGXt/nJWofrbX3pjLshglX6aMbv6AzLR5GLz44IbnQU6pp7btjdjM29d0m e7fw== 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=r6XbCZzV4HWSavBC1pWxjd/SIDcNZbLfLUuG7khMHb6VS3xlz6pKC/DQWMIKSZSB8M Azfmodnj0KMhhuX33vFe55VKw1DYfztDOJTUGRDoC71G4lzfjpTeRCCTjZa7AHtDbvlH UPxn1tRTET3dAzjKdfHGNu7S9PotPkPOgdVa5mKhMYhoLTk0cZfN+8Cv9wtnF5rp8SDi 2/GMuGcpxHtwx0UwXrEKdRjIYn5FO7PckSiA64Y0r1yLxAjuhy3xqCP744GJ1fXB0P3u E77ECKmyy/yTn/q8SEOZ2gpoVeq3jSd2MzxBpi8Zqt66FbYdeNdg8+7AM8EhrN+L8auj WnPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp-br.20150623.gappssmtp.com header.s=20150623 header.b=0mvHuAu7; 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 w18-v6si13379117pfg.70.2018.10.26.19.01.09; 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=0mvHuAu7; 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 S1727583AbeJ0Kj7 (ORCPT + 99 others); Sat, 27 Oct 2018 06:39:59 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:39943 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbeJ0Kj6 (ORCPT ); Sat, 27 Oct 2018 06:39:58 -0400 Received: by mail-qk1-f194.google.com with SMTP id f18-v6so1840417qkm.7 for ; Fri, 26 Oct 2018 19:00:38 -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=0mvHuAu73tBFg2S2xrmm13wOe/2ZPE0w3h1ybC4dfMYqIkCJajhFGuOcRZ457PFVVq qIoc9L6ErihoxUKmAwQBcw2HBkOH02vz1dDMnSyleijBuYHm3/xNNcLEM60zSoH3ekKR /gLgC6Ec/vsMOuYYWmN+8g9TUZYp/+gkkCtVyVXtUWT3tWFfliczUUQ4fEwxt9M/a7wV 93gHnTH3KJpK6y2q3SasjrkL6ESkvPgA3hLemUZF4ZKXQsX1OEVX+MfM9OgTDPrJKMq+ D8uFFN4sjoZK1gYb/nP66iSuktTXlopIh+Nq5JOfpayoTjBCyqP3UV9VLEu9UR7SBS0/ 6tIg== 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=MtqSkXszxgL3A0vbmVlZtakdQHoUadM6Z+jPcFIAkiToq+m1yy7yW/Etn7iNmODdYT C1MpjQVCJpQ2k2IYXeyumXH0lWRJNu2TUTxOavRkj/DjRW7HnUIHBLB8M0MG29INAyzL ralLMhcqxYqYasdFUgG7LbrQI1MQjA/kMo+YBkemrImwhGFjoqBPHTy1PeYmjDATuUO/ f5FYUMhs7M5JFzTGtcBHhaF8EjzVZLLMB/cDUEMjdqPEltId3lPSsFO+RfB79PwFfzAt qc8F3z0VeHal12XXcPIpc2lvR3i/8aoWAblGEVyHHfkzEd4hDA/ke9JiigxqrtNA7+5W x2Rg== X-Gm-Message-State: AGRZ1gIiSlvizNUwfp8WLuN1UFHfjNCwuUbfIg7lRMXHuWVvQ58iWKqp /jRXvNDVWcdvLgO63jQ+wR4M5Q== X-Received: by 2002:a37:aa91:: with SMTP id t139mr5101949qke.139.1540605638037; Fri, 26 Oct 2018 19:00:38 -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.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 19:00:37 -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 1/6] staging:iio:ad2s90: Make read_raw return spi_read's error code Date: Fri, 26 Oct 2018 23:00:00 -0300 Message-Id: <20181027020005.3140-2-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, 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