From patchwork Wed May 12 14:44:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 435590 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4998283jao; Wed, 12 May 2021 09:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDqbNVBAms2SUQi2dTYE3WK0kYkdwIy6RgFUGAgMf0VfiiikX4S6c8yccFwA0DoRgtJtpS X-Received: by 2002:a6b:e719:: with SMTP id b25mr25995793ioh.49.1620837791984; Wed, 12 May 2021 09:43:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620837791; cv=none; d=google.com; s=arc-20160816; b=G6U+a4Zhaf5jtOaW1SgZtaODh7EHFDkOfC3ImAFyoJd4GIMB0IrtkSuCpNGZ4NwXwJ 4pPjQBanP78lHrJYE+BfvuBGUEXNd/6AVPt3CYbfPBjJw+5G6usgWrlEXMmlYpZmKS8O 97fP1uoenM6n4GM93eo6trCC3C1v/f0HDoPmB72+WuqUd9Qk1zn8d0x+Dc6JP1/TV4RE B/8md362de+vK6lvjIR/5UEqv8DUnsLbG7zzZMI9CSsaq6//cv1WcZ/PF3cT6L3cIWH2 3nc+5FeqSufaIhh3RFbkFZGxCfw4DKzMhVNo/TcRz/7td5Fs7AK6VpN9wxoyqqDdM/64 ELLQ== 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=YfmHPocHi/6059DpNc1N1uTiz294QH1bKK0TRebecPA=; b=KqNSh9aDmbqh9vlumjh0NMXDJkcMOQbg6NDnRCy8/Z7KBZ2VOI4kKM8pNCbfj1rSRp IGf2isymVFKNrvZ530EEAIVvZZYg7I5SFiUTYm8LFtZ9ScYnIaCXUqf6bcOQpzcX2MMT 5axzLcPYOTNpdEZp5XzXLrFbcQ1oyC7wGhn5DnMJ+QOuEB8MnQCr3uQn36N6v+qKtZ/Q MCMVWDjAdOmwcnlXuzrRL42AtX43n8g0AZBIVKWBDL7DMlkLcTzh5lPza5E1Tqop8fls autWjSJ6Uc+HP1geAEBxiY5i7MFS5mVFNUGC5hSq47rizooJn4kQp1hJ6z2poiyR0nRf MIVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Lcz5esSi; 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 q8si330223ior.12.2021.05.12.09.43.11; Wed, 12 May 2021 09:43:11 -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=Lcz5esSi; 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 S237033AbhELQDU (ORCPT + 12 others); Wed, 12 May 2021 12:03:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:38450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238269AbhELP5f (ORCPT ); Wed, 12 May 2021 11:57:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 02BF561CB4; Wed, 12 May 2021 15:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620833478; bh=mUVS9Ll7TCgvXkDaEevOf7FgfCdqWZyPhFYSSRyxL/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lcz5esSiAu4ksDn+XHoKphgL38AKcnZVDJraj8SFTP8/sJeTmhjWRYD9uqt0SN3Sv JepApNngU/z/jM5ZHUdgkbBzVDuzK7GQmXLhN8TlDce8fidKt+hxZ5uS27J6zQ0Fp1 VBrj35i2GA/sjcpOcZJfeZiU7kZSOesUmOjm4Et8= 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.11 165/601] spi: rockchip: avoid objtool warning Date: Wed, 12 May 2021 16:44:02 +0200 Message-Id: <20210512144833.268387658@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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 09d8e92400eb..0e2c377e9e55 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -476,7 +476,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) { @@ -521,7 +521,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) { @@ -554,6 +556,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) @@ -577,6 +581,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) && @@ -596,7 +601,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);