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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 861B9C433E6 for ; Fri, 28 Aug 2020 09:53:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56668208D5 for ; Fri, 28 Aug 2020 09:53:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56668208D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57F446E463; Fri, 28 Aug 2020 09:53:39 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id A00FA6E463 for ; Fri, 28 Aug 2020 09:53:38 +0000 (UTC) IronPort-SDR: FWOpJdnMK5FmJkqOboJeehnUqI1143lM2ZAWg+RiN1HpyHrOP4YEQrxBX1bH6B4uAENEwvYeOv A1Km3/Y8dp+A== X-IronPort-AV: E=McAfee;i="6000,8403,9726"; a="174689629" X-IronPort-AV: E=Sophos;i="5.76,363,1592895600"; d="scan'208";a="174689629" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 02:53:37 -0700 IronPort-SDR: 4k6ijHHaBPEq0prFkQCkFP3qZerS0iQb7KjjZfzI/YTtyEkWgwFOFdK0usdb2l8PEuwbEskMcs WeVg6ucdBTuw== X-IronPort-AV: E=Sophos;i="5.76,363,1592895600"; d="scan'208";a="475618716" Received: from junhoson-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.35.131]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2020 02:53:34 -0700 From: Jani Nikula To: Dan Carpenter , malat@debian.org Subject: Re: [bug report] drm/dp: annotate implicit fall throughs In-Reply-To: <20200825112759.GA287100@mwanda> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20200825112759.GA287100@mwanda> Date: Fri, 28 Aug 2020 12:53:32 +0300 Message-ID: <87v9h33xlv.fsf@intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, 25 Aug 2020, Dan Carpenter wrote: > Hello Mathieu Malaterre, > > The patch e9c0c874711b: "drm/dp: annotate implicit fall throughs" > from Jan 14, 2019, leads to the following static checker warning: > > drivers/gpu/drm/drm_dp_helper.c:495 drm_dp_downstream_max_bpc() > warn: ignoring unreachable code. > > drivers/gpu/drm/drm_dp_helper.c > 467 int drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE], > 468 const u8 port_cap[4]) > 469 { > 470 int type = port_cap[0] & DP_DS_PORT_TYPE_MASK; > 471 bool detailed_cap_info = dpcd[DP_DOWNSTREAMPORT_PRESENT] & > 472 DP_DETAILED_CAP_INFO_AVAILABLE; > 473 int bpc; > 474 > 475 if (!detailed_cap_info) > 476 return 0; > 477 > 478 switch (type) { > 479 case DP_DS_PORT_TYPE_VGA: > 480 case DP_DS_PORT_TYPE_DVI: > 481 case DP_DS_PORT_TYPE_HDMI: > 482 case DP_DS_PORT_TYPE_DP_DUALMODE: > 483 bpc = port_cap[2] & DP_DS_MAX_BPC_MASK; > ^^^^^^^^^^^^^^^^^^ > This is 0x3. > > 484 > 485 switch (bpc) { > 486 case DP_DS_8BPC: > 487 return 8; > 488 case DP_DS_10BPC: > 489 return 10; > 490 case DP_DS_12BPC: > 491 return 12; > 492 case DP_DS_16BPC: > 493 return 16; > 494 } > 495 fallthrough; > > This fallthrough is impossible. Probably the way to work around the > bogus warning is the change the fallthough to "return 0; /* impossible */" > otherwise the fallthrough is sort of misleading... Won't that be unreachable as well? Maybe just add the default label to switch (bpc)? BR, Jani. > > 496 default: > 497 return 0; > 498 } > 499 } > > regards, > dan carpenter > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Jani Nikula, Intel Open Source Graphics Center _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel