From patchwork Thu Dec 15 16:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 635066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9890C4167B for ; Thu, 15 Dec 2022 16:29:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbiLOQ3u (ORCPT ); Thu, 15 Dec 2022 11:29:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230000AbiLOQ31 (ORCPT ); Thu, 15 Dec 2022 11:29:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40D3232B84; Thu, 15 Dec 2022 08:29:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD69861E62; Thu, 15 Dec 2022 16:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18432C433D2; Thu, 15 Dec 2022 16:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671121752; bh=hTVlrLLNPPrnPwLwZn/P6XxxNEQh61wi48u/i/H+3Fk=; h=From:To:Cc:Subject:Date:From; b=sMsCqgJjCYkzb8omjFTfh4gJjfPdKVca1gyUvNd+kGHH2Catybh3ApOuNimtbNH5M WpFGmqWe2JnVK4HAJ9xt+ydJm1FkNeDwlX5w1c7ODEOVgxpmO2QDbWH6Z1m3W7hYX8 cQJ8Xi3DUs88KozktfLLO+cHB4MEPeQlmyO6WO82RwNzMfCsG3O1rDhEICcCWYbP8P B/BdfesiqAZDfiLF54HDkICKCyI+XLUcAXQ7YLEzeJPzJ2pIuYBocpBMgDljBvpYYf pN6UdnmV0KSsLbq2Qy/2z2zwwjlYV7GySiFPy7kYXbIwO1GtB9ZywIpRxdLA+XTx1P 1bnxVt5LBn6NQ== From: Arnd Bergmann To: Robert Foss , Todor Tomov Cc: Josh Poimboeuf , Peter Zijlstra , Arnd Bergmann , Andy Gross , Bjorn Andersson , Konrad Dybcio , Mauro Carvalho Chehab , Hans Verkuil , Jonathan Marek , "Bryan O'Donoghue" , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] media: camss: csiphy-3ph: avoid undefined behavior Date: Thu, 15 Dec 2022 17:28:46 +0100 Message-Id: <20221215162905.3960806-1-arnd@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Arnd Bergmann Marking a case of the switch statement as unreachable means the compiler treats it as undefined behavior, which is then caught by an objtool warning: drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.o: warning: objtool: csiphy_lanes_enable() falls through to next function csiphy_lanes_disable() Instead of simply continuing execution at a random place of the driver, print a warning and return from to the caller, which makes it possible to understand what happens and avoids the warning. Fixes: 53655d2a0ff2 ("media: camss: csiphy-3ph: add support for SM8250 CSI DPHY") Signed-off-by: Arnd Bergmann --- drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 451a4c9b3d30..04baa80494c6 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -429,7 +429,8 @@ static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy, array_size = ARRAY_SIZE(lane_regs_sm8250[0]); break; default: - unreachable(); + WARN(1, "unknown cspi version\n"); + return; } for (l = 0; l < 5; l++) {