From patchwork Wed May 12 14:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 435569 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4944572jao; Wed, 12 May 2021 08:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzAYnTJDCVQPQudJSO+SSCk9LGWCZCDF+YjGJVLMT5ICwfLq+7X75J7UhmVI5y3Y3Fzwta X-Received: by 2002:a05:6512:208b:: with SMTP id t11mr24961855lfr.358.1620834081376; Wed, 12 May 2021 08:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834081; cv=none; d=google.com; s=arc-20160816; b=fFgJasoASW7z/br1EDT6Mrh4osJP0QVfEE4OWQXXW37y+fAgY5VYTphXoYxfDVzpxA Lf8n2dtqVIrXeFjjGT4SN0dcUcWgrjc4SwoHo9J3ISttYXEGLCKQvCqliF3OhfIIUOy2 cFtNsEUu5BnkVr5e9yrHcBkUSizHyyNIdAmksGS4BtPkEvOJmanj0vRAI8u43TxyZVM8 OXVeccRW1AGZAUaM1jXQT06G/ndAyE7fq2/LHqJKf/Gb1TsViliZOB1S/HIgigcjvhyH WCfkRtvcp4lddHcziVE4ffZly8s2v4+RK5MLqQsykro/VcJJrIU+QZgYvx89EFIxh4Cv 0Hpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T1Al3N1M58HdGD5+QjgAkdRETHMTX6CwEIdLOJhdd0I=; b=zDOBl5wolS+5njJuKThQtRK83lozo+eIIvsUf9mkqhwTUDbisxUK964OSXtpmVvLk/ IQXU8baIQn12okLiMEOT6k9IHgfQwuz0tyfiBKLG0x6xkHA0s8+812lghX0wqpQTZQmN KysZLkkgo49SPg3QSosmChbZS0kojDfzEkrNp/rQP/gnsHXvcJcgJrw0Ep/RS9h6+syu 2guV9ELKDaIE97wA7FiVZOMe09d8t2SqRkLZksYqivwrpsJfmy7/Mp/JoGxS1PEVX23E XrXwQKwj290OACf/9mQzsKoN8RW31rVWQOi2AlZzeQU4crBKvI0CcMKy3t3/Zf13j6ha e2Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Myd2ObDO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si100438lji.284.2021.05.12.08.41.21; Wed, 12 May 2021 08:41:21 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Myd2ObDO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234546AbhELPdJ (ORCPT + 12 others); Wed, 12 May 2021 11:33:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:60626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234260AbhELPY1 (ORCPT ); Wed, 12 May 2021 11:24:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E8F53619C4; Wed, 12 May 2021 15:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832197; bh=ZV80my+I1svhi5JABl9+BXob3kh/NadGRy3NUwdmZHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Myd2ObDOulME9xaq6q9qyCBe6IzA7ZXD/7+DOd0OKHakxa44hTccGCwwhMEoVWX7u 1FRNiax4qp6vHbyH/QdiFsfKpyDkDOqFAdoFVxmnwCP794lDkEzpKIw799YRojAfTA 0C57gNYMpWe2sA+n2XuQSOkpnLPvLMMFYpOTMXbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Pratyush Yadav , Mark Brown , Sasha Levin Subject: [PATCH 5.10 147/530] spi: rockchip: avoid objtool warning Date: Wed, 12 May 2021 16:44:17 +0200 Message-Id: <20210512144824.673856820@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann [ Upstream commit e50989527faeafb79f45a0f7529ba8e01dff1fff ] Building this file with clang leads to a an unreachable code path causing a warning from objtool: drivers/spi/spi-rockchip.o: warning: objtool: rockchip_spi_transfer_one()+0x2e0: sibling call from callable instruction with modified stack frame Change the unreachable() into an error return that can be handled if it ever happens, rather than silently crashing the kernel. Fixes: 65498c6ae241 ("spi: rockchip: support 4bit words") Signed-off-by: Arnd Bergmann Acked-by: Pratyush Yadav Link: https://lore.kernel.org/r/20210226140109.3477093-1-arnd@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-rockchip.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 75a8a9428ff8..0aab37cd64e7 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -474,7 +474,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs, return 1; } -static void rockchip_spi_config(struct rockchip_spi *rs, +static int rockchip_spi_config(struct rockchip_spi *rs, struct spi_device *spi, struct spi_transfer *xfer, bool use_dma, bool slave_mode) { @@ -519,7 +519,9 @@ static void rockchip_spi_config(struct rockchip_spi *rs, * ctlr->bits_per_word_mask, so this shouldn't * happen */ - unreachable(); + dev_err(rs->dev, "unknown bits per word: %d\n", + xfer->bits_per_word); + return -EINVAL; } if (use_dma) { @@ -552,6 +554,8 @@ static void rockchip_spi_config(struct rockchip_spi *rs, */ writel_relaxed(2 * DIV_ROUND_UP(rs->freq, 2 * xfer->speed_hz), rs->regs + ROCKCHIP_SPI_BAUDR); + + return 0; } static size_t rockchip_spi_max_transfer_size(struct spi_device *spi) @@ -575,6 +579,7 @@ static int rockchip_spi_transfer_one( struct spi_transfer *xfer) { struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); + int ret; bool use_dma; WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && @@ -594,7 +599,9 @@ static int rockchip_spi_transfer_one( use_dma = ctlr->can_dma ? ctlr->can_dma(ctlr, spi, xfer) : false; - rockchip_spi_config(rs, spi, xfer, use_dma, ctlr->slave); + ret = rockchip_spi_config(rs, spi, xfer, use_dma, ctlr->slave); + if (ret) + return ret; if (use_dma) return rockchip_spi_prepare_dma(rs, ctlr, xfer);