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.0 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 6ECD1C282CE for ; Mon, 11 Feb 2019 16:13:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35B9521B24 for ; Mon, 11 Feb 2019 16:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549901633; bh=xSwifuhy/T2YY0NENWcp6n4ouY2PQ83gQpI+43iNxbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0LYplW3Tk5hRZOt+v1EXcnftxQ8lW1HehujTAexlV0mxTzD6PsVqbsfEccIDWn8Zg saRaO7CAYAVYoPLzxqkRU3oYVHuZ82F3/dximROg8lVm+lTrKsD+p3JOpQa4HBPoEm 0BV9CaBVzKpmRi7QZrbKxXh+ORumAJCVJ0Nl+xm4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727673AbfBKOWQ (ORCPT ); Mon, 11 Feb 2019 09:22:16 -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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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