Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2648288imj; Mon, 11 Feb 2019 06:26:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZNQmIpO6O06BavH/sDM9iVZyfFwpeqj6oH42ZMkoQcDQ0D7LnFWZ/m9Su9V94TEXCl47t2 X-Received: by 2002:a63:fb15:: with SMTP id o21mr33579545pgh.211.1549895204132; Mon, 11 Feb 2019 06:26:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895204; cv=none; d=google.com; s=arc-20160816; b=W9h98YvyJ4DsWNW28gaQfuon8nVXIqLuVaGWzX0b222yBiRB0sz3kauxtGVfLx1xxg /vobypWpJL/o251V35JWYNvvIff7xfln/yER+C8dQpvRTO9NgJrR+wDsQJyuz40zw/gy 1/RCUZg+g3tIavBP9w9T/m8s8zLSQdvlVv8N4Z7M5/MFhO2AaWGIwYGSvHTdaktN+lxf dl0E1rEa7bGCDu72oYSDwrB5hzDxm7sjqPyaw9ezlgd9isCgt92PYv9uerhoxbWIDxuD 7a+STqqEQhsUb5d9vjrgBYu9P8Tn0fcM2gWUqkCvQjqCKDBVBWkATVOd/vhQPu2ZoxMh Nqpg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xF6LGkoD1AtLnaZ10eWEOgLCFAq0YYgjihhz6bmDn7A=; b=k4X7sUrWc007z18H98oZ+NpLgctgImfTTseGgp0irtbji1RbTiuMFQt8ZAXW3/Fr+J ggXT/QlN5Xc7UM5TwxHX4nC+1v8bPgibT2Oq0DEXcnyWnvCG9NCouf+r5njoQlJcz1lu 0lrwYto2mXFkyBH9DOe34Zs5JaQpGiy28Lte6TO/vHT2e7oir5VXfFnCCm7/jU+iQucJ hE5EIpsoh9Q8RKDy+ak25S3iwK5M2+NM7SVYX2dbNmqbuDs3df0sqByx05NLv3qhHggf RhUbQPuiRibPLZfwuhr/EYNMWQ7JBM2y0WZhRXMPtXT2eAQyVrbRwmHfDUmhnzixhezA B/mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v84vCxFc; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 66si9604836pfk.209.2019.02.11.06.26.28; Mon, 11 Feb 2019 06:26:44 -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=v84vCxFc; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728717AbfBKOWR (ORCPT + 99 others); Mon, 11 Feb 2019 09:22:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:55164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727551AbfBKOWQ (ORCPT ); Mon, 11 Feb 2019 09:22:16 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D604A20838; Mon, 11 Feb 2019 14:22:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894935; bh=xSwifuhy/T2YY0NENWcp6n4ouY2PQ83gQpI+43iNxbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v84vCxFc1pRSf/yRy+FewZnFAhWL8H6x0DYQLn7U6tOomwh6LeHoA6r6Tmzfu7y2M 8q+tQAGNLoZEgxF/6Gw/Gt5X1bxYI7GU+aEOBnkJjAuFODVNGOYGsgpvp9nUy7ctVP jeMsS2cNRVJ+FlL8TSVTIvOwH/2HB62TqgjQUzBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matheus Tavares , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.20 036/352] staging:iio:ad2s90: Make probe handle spi_setup failure Date: Mon, 11 Feb 2019 15:14:23 +0100 Message-Id: <20190211141848.630191973@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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