From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA791C43381 for ; Mon, 18 Feb 2019 14:00:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 866F521902 for ; Mon, 18 Feb 2019 14:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498450; bh=KFuN3Y4ZR3zuGyhUVvB0mVCxYod7xC6iVzIRkFpMumg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=onjrB/WJseMjjpkeejGCYPULoPNdAI2Hc5Idv1xcydt1Q1KCLLGsPzCkC48D75vvM S1lpY/tgwUMAKUWeWXYcbAv7Epk0z8sab72j3kxd+lJpTPVkMwxriU8iCrJ8Y8E+bL 0blQp12lzzJStC7U4/kFe6dQ0ZbY1lrNey3KkbXY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388920AbfBROAs (ORCPT ); Mon, 18 Feb 2019 09:00:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:42046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388089AbfBROAp (ORCPT ); Mon, 18 Feb 2019 09:00:45 -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 DD8C020842; Mon, 18 Feb 2019 14:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498444; bh=KFuN3Y4ZR3zuGyhUVvB0mVCxYod7xC6iVzIRkFpMumg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BybA9gWVGSSxb/8QiFufHvN+AT4tMrvYuWw6PZ9aAivYDtMiSqW6S8asay5LT2iPV QL/t8lXVwSUPurRGoZ7jMjZ9/bItcixNlkXyeKmGhE/Cto6gv1fOktWJ74McMpHrgi xJ5Gfs8ZbroQGBkMJE/ZvVebrOfUaEemg4FJU6FA= 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.4 011/143] staging:iio:ad2s90: Make probe handle spi_setup failure Date: Mon, 18 Feb 2019 14:42:19 +0100 Message-Id: <20190218133529.574124155@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133529.099444112@linuxfoundation.org> References: <20190218133529.099444112@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.4-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 5b1c0db33e7f..b44253eb62ec 100644 --- a/drivers/staging/iio/resolver/ad2s90.c +++ b/drivers/staging/iio/resolver/ad2s90.c @@ -86,7 +86,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