Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3711474imu; Mon, 28 Jan 2019 09:26:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN6phn0OfrNy+7zEx6p/fNGZotJuFNnQvKV2JGq6/qMBELCqTgF+zLPB47bTwZMijadp0w6c X-Received: by 2002:a62:2702:: with SMTP id n2mr23196424pfn.29.1548696418646; Mon, 28 Jan 2019 09:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696418; cv=none; d=google.com; s=arc-20160816; b=XaAedfkeOYayCzV9+Q9OxNLeo+QRJszNcKi2qZHs+vuU+Jfr+GYAbQFgZriN9MBCtY HE22iG8du0g8c+APCcnJmBCzr+JVuKw02QKqS1S/Bfw6I1BR6ZUGtU7IwOSKi2dbyoLw x6pq7eff6/J1X4950UzqfbtFfkv8BJnojiKpDoAkEgxHKnD0YXv3tKJmybGbeGt4mhbB 6rrdOZRkUltCzCx7l863EqGPgLdCyrdx3DOMqsLqmTCJKD7LJ50lPeAvs6LFmwhmWf7P Ep4vovKQLsOeVzMPYrEXSE+RVffk46wyNwGBxoEiloiy3SqtSYlY0qaCXwD7Eg4t715h iClA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dY8Dgg8bNwkFsEka18JsQp5tuDhOieW8N8mvKJjv/HQ=; b=bpw+7po83gL3UxcC776Y9gOg47YhLsUbS2Yh1KUUfCTMPEKcmX576l0/wz+RkjkB+D 1caCWWDOuxgQzmG5JhwzhEYBsV12N/A3Q2vpHwlhNeZkVyqqPwCikCEy1RHhJqjBYXV6 bqLhzWCsl07E8wqRHyXL2AhNmeu7y3G/CNujO381VvaXPACluea6qdAZg+b32HtRZ+GP xrUC1b065SDUdmulbFLMJyBLfOTqoMGxCQX/RmjqAAxmpdsVC2n7BwoapIjzL0O0fN5i zRd4BB0xJypLC/8WeFxvz8iNJAVrIPvzA07oMjYE0lV1SovtBCMadTYAsf5I9ERq4aP6 HrUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0nSYh+sF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id go15si30937087plb.219.2019.01.28.09.26.43; Mon, 28 Jan 2019 09:26:58 -0800 (PST) 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=@kernel.org header.s=default header.b=0nSYh+sF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730931AbfA1RZq (ORCPT + 99 others); Mon, 28 Jan 2019 12:25:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:46344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730038AbfA1QBC (ORCPT ); Mon, 28 Jan 2019 11:01:02 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6EE892082E; Mon, 28 Jan 2019 16:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691262; bh=diX1bXR/Pgzq6AjL+YI5dptdTs8pz+nfvR1rg8yppW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0nSYh+sF1/v0zlaDg29WdAtqFBkJ1P7zZZ/uHGaDMUTNzAFo4yWI+WE5FXM4pECjM kb0yYAgEALgcjf/WEqV9u+lGlhLSQiiUEc36NmlFo1XhqoiU1T6hbAHYBZiQNY8pER hr0ywiM2Oat+EvVXLWwxSebaer8zCKYj0KD4fRUI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Matheus Tavares , Jonathan Cameron , Sasha Levin , linux-iio@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 4.19 036/258] staging:iio:ad2s90: Make probe handle spi_setup failure Date: Mon, 28 Jan 2019 10:55:42 -0500 Message-Id: <20190128155924.51521-36-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matheus Tavares [ Upstream commit b3a3eafeef769c6982e15f83631dcbf8d1794efb ] 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. Note: The 'return ret' statement could be out of the 'if' block, but this whole block will be moved up in the function in the patch: 'staging:iio:ad2s90: Move device registration to the end of probe'. Signed-off-by: Matheus Tavares Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- 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 59586947a936..51cda9151412 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -85,7 +85,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.19.1