From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============4875266763308059993==" MIME-Version: 1.0 From: Gustavo A. R. Silva To: kbuild-all@lists.01.org Subject: Re: [gustavoars-linux:testing/fallthrough 144/560] drivers/gpu/drm/drm_dp_helper.c:492 drm_dp_downstream_max_bpc() warn: ignoring unreachable code. Date: Tue, 07 Jul 2020 10:25:54 -0500 Message-ID: <20200707152554.GC11125@embeddedor> In-Reply-To: <20200707140717.GA2549@kadam> List-Id: --===============4875266763308059993== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi, I think there is room for improvement here. Please, see my comments below... On Tue, Jul 07, 2020 at 05:07:17PM +0300, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.= git testing/fallthrough > head: d7f10c2411ed9283df8d763139de9468b88c89ce > commit: 62708a516a6b158e213c46ff731260cb988dbc11 [144/560] drm: Use fallt= hrough pseudo-keyword > config: i386-randconfig-m021-20200703 (attached as .config) > compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 > = > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > = > smatch warnings: > drivers/gpu/drm/drm_dp_helper.c:492 drm_dp_downstream_max_bpc() warn: ign= oring unreachable code. > = > # https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/co= mmit/?id=3D62708a516a6b158e213c46ff731260cb988dbc11 > git remote add gustavoars-linux https://git.kernel.org/pub/scm/linux/kern= el/git/gustavoars/linux.git > git remote update gustavoars-linux > git checkout 62708a516a6b158e213c46ff731260cb988dbc11 > vim +492 drivers/gpu/drm/drm_dp_helper.c > = > 7529d6af1cd16b Mika Kahola 2016-09-09 464 int drm_dp_downstream= _max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE], > 7529d6af1cd16b Mika Kahola 2016-09-09 465 const u8 por= t_cap[4]) > 7529d6af1cd16b Mika Kahola 2016-09-09 466 { > 7529d6af1cd16b Mika Kahola 2016-09-09 467 int type =3D port_ca= p[0] & DP_DS_PORT_TYPE_MASK; > 7529d6af1cd16b Mika Kahola 2016-09-09 468 bool detailed_cap_in= fo =3D dpcd[DP_DOWNSTREAMPORT_PRESENT] & > 7529d6af1cd16b Mika Kahola 2016-09-09 469 DP_DETAILED_CAP_INF= O_AVAILABLE; > 7529d6af1cd16b Mika Kahola 2016-09-09 470 int bpc; > 7529d6af1cd16b Mika Kahola 2016-09-09 471 = > 7529d6af1cd16b Mika Kahola 2016-09-09 472 if (!detailed_cap_in= fo) > 7529d6af1cd16b Mika Kahola 2016-09-09 473 return 0; > 7529d6af1cd16b Mika Kahola 2016-09-09 474 = > 7529d6af1cd16b Mika Kahola 2016-09-09 475 switch (type) { > 7529d6af1cd16b Mika Kahola 2016-09-09 476 case DP_DS_PORT_TYPE= _VGA: > 7529d6af1cd16b Mika Kahola 2016-09-09 477 case DP_DS_PORT_TYPE= _DVI: > 7529d6af1cd16b Mika Kahola 2016-09-09 478 case DP_DS_PORT_TYPE= _HDMI: > 7529d6af1cd16b Mika Kahola 2016-09-09 479 case DP_DS_PORT_TYPE= _DP_DUALMODE: > 7529d6af1cd16b Mika Kahola 2016-09-09 480 bpc =3D port_cap[2]= & DP_DS_MAX_BPC_MASK; > 7529d6af1cd16b Mika Kahola 2016-09-09 481 = > 7529d6af1cd16b Mika Kahola 2016-09-09 482 switch (bpc) { > 7529d6af1cd16b Mika Kahola 2016-09-09 483 case DP_DS_8BPC: > 7529d6af1cd16b Mika Kahola 2016-09-09 484 return 8; > 7529d6af1cd16b Mika Kahola 2016-09-09 485 case DP_DS_10BPC: > 7529d6af1cd16b Mika Kahola 2016-09-09 486 return 10; > 7529d6af1cd16b Mika Kahola 2016-09-09 487 case DP_DS_12BPC: > 7529d6af1cd16b Mika Kahola 2016-09-09 488 return 12; > 7529d6af1cd16b Mika Kahola 2016-09-09 489 case DP_DS_16BPC: > 7529d6af1cd16b Mika Kahola 2016-09-09 490 return 16; > 7529d6af1cd16b Mika Kahola 2016-09-09 491 } > 62708a516a6b15 Gustavo A. R. Silva 2020-07-02 @492 fallthrough; > ^^^^^^^^^= ^^ Notice that the statement above and the code below is actually reachable if _bpc_ doesn't match any of the switch cases. Thanks -- Gustavo > = > 7529d6af1cd16b Mika Kahola 2016-09-09 493 default: > 7529d6af1cd16b Mika Kahola 2016-09-09 494 return 0; > 7529d6af1cd16b Mika Kahola 2016-09-09 495 } > 7529d6af1cd16b Mika Kahola 2016-09-09 496 } > = > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============4875266763308059993==--