Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4606875pxj; Wed, 12 May 2021 09:07:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeiwQ8TzQru/lhi9Li1pVyvljniF7FVxYeU8qf3P8iPjbMEeqUP/VJlPWrpWVMITg3a8ru X-Received: by 2002:aca:4dc3:: with SMTP id a186mr8024412oib.22.1620835679218; Wed, 12 May 2021 09:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835679; cv=none; d=google.com; s=arc-20160816; b=xWz8SrF7rhyJ4HwgOjfIrOStpMWo0J5iZHws4wQQz2oq5RNJkrBP35rqTkV9kx8W06 xRyBABNs/PwijiQr29QC6UaQoe+ujx1GRj4Q0q3lGOxJex7ZhHPIEEZ2nOZrxy5yUrsc KgavA5k26rvicd96vW6aWgUiuM4LQxW4zi9RGGSc4nwtOL21w857llkPtWHQ7ok3axjB mZp/fDqccDwVxMt/q7+H421LHD9ERFNE95QWCofStxavOCa4N7SQNoVnndEyCd9EdUOK TdxbOEVwo3w0t0JjL26P6LvQCABZJYeehP84y3yD8Tc7+3kQxaOib7BwAGX/97EEO8MW zwHg== 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=L3FPf2mXRd0LhjA+fqTCM5D/DrfIcwY/VtPbqF13iy9JExQ2niiDc0gc5hsz1koSZN SiEdO5HD1AKPDskwQ9PJtr8ptpim0QpnVesrEnl1kP8AzUCuHa5QHVB0flr24JpdeBOy tqOe3zyJutV2eDB5L06zTy28Guz5fmYxYMQD73dLSdrReMx6GTquTqTeIAOIibruCL5k ptF8RbCS+fPYQFZHcvr9WJpoID2V1v6/fXNu+GqKSLEzL35uIEA2hXVC0VZOEqfBaUQ3 9PXDHCWqVeFQjribbW5D+HBhNELHuMv9kATYlRJKV/vibJhNIYabTV+bRjBQkPfsFdqA 0Plw== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 i130si412632oia.211.2021.05.12.09.07.45; Wed, 12 May 2021 09:07:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S238767AbhELQGQ (ORCPT + 99 others); Wed, 12 May 2021 12:06:16 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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); -- 2.30.2