[<prev] [next>] [day] [month] [year] [list]
Message-ID: <25d3bff8-4331-73be-f1ff-8c922f5028c5@intel.com>
Date: Mon, 15 Aug 2022 09:55:40 +0800
From: kernel test robot <yujie.liu@...el.com>
To: Hans Verkuil <hverkuil@...all.nl>
CC: <llvm@...ts.linux.dev>, <kbuild-all@...ts.01.org>,
"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: [hverkuil-media-tree:tegrav8 2/7]
drivers/media/i2c/tc358840.c:1647:3: warning: Value stored to 'have_hdcp' is
never read [clang-analyzer-deadcode.DeadStores]
tree: git://linuxtv.org/hverkuil/media_tree.git tegrav8
head: 386823032a34ce7926c18033b0ca34de9145a206
commit: f51f9140626da0e72ade6bd437ac2fe13e9b0425 [2/7] tc358840: add Toshiba tc358840 HDMI-to-CSI bridge.
config: mips-randconfig-c004-20220808 (https://download.01.org/0day-ci/archive/20220813/202208131429.45nzEuBD-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mipsel-linux-gnu
git remote add hverkuil-media-tree git://linuxtv.org/hverkuil/media_tree.git
git fetch --no-tags hverkuil-media-tree tegrav8
git checkout f51f9140626da0e72ade6bd437ac2fe13e9b0425
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips clang-analyzer
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <yujie.liu@...el.com>
clang-analyzer warnings: (new ones prefixed by >>)
>> drivers/media/i2c/tc358840.c:1647:3: warning: Value stored to 'have_hdcp' is never read [clang-analyzer-deadcode.DeadStores]
have_hdcp = !(i2c_rd8(sd, HDCP_MODE) &
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/have_hdcp +1647 drivers/media/i2c/tc358840.c
f51f9140626da0 Hans Verkuil 2020-02-21 1608
f51f9140626da0 Hans Verkuil 2020-02-21 1609 static void tc358840_delayed_work_poll(struct work_struct *work)
f51f9140626da0 Hans Verkuil 2020-02-21 1610 {
f51f9140626da0 Hans Verkuil 2020-02-21 1611 struct delayed_work *dwork = to_delayed_work(work);
f51f9140626da0 Hans Verkuil 2020-02-21 1612 struct tc358840_state *state = container_of(dwork,
f51f9140626da0 Hans Verkuil 2020-02-21 1613 struct tc358840_state, delayed_work_poll);
f51f9140626da0 Hans Verkuil 2020-02-21 1614 struct v4l2_subdev *sd = &state->sd;
f51f9140626da0 Hans Verkuil 2020-02-21 1615 u8 sys_status;
f51f9140626da0 Hans Verkuil 2020-02-21 1616 bool have_5v;
f51f9140626da0 Hans Verkuil 2020-02-21 1617 bool have_tmds;
f51f9140626da0 Hans Verkuil 2020-02-21 1618 bool have_sync;
f51f9140626da0 Hans Verkuil 2020-02-21 1619 bool have_signal;
f51f9140626da0 Hans Verkuil 2020-02-21 1620 bool have_hdcp;
f51f9140626da0 Hans Verkuil 2020-02-21 1621 unsigned int format_change = 0;
f51f9140626da0 Hans Verkuil 2020-02-21 1622
f51f9140626da0 Hans Verkuil 2020-02-21 1623 mutex_lock(&state->lock);
f51f9140626da0 Hans Verkuil 2020-02-21 1624
f51f9140626da0 Hans Verkuil 2020-02-21 1625 sys_status = i2c_rd8(sd, SYS_STATUS);
f51f9140626da0 Hans Verkuil 2020-02-21 1626 have_5v = state->test_pattern || (sys_status & MASK_S_DDC5V);
f51f9140626da0 Hans Verkuil 2020-02-21 1627 have_tmds = state->test_pattern || (sys_status & MASK_S_TMDS);
f51f9140626da0 Hans Verkuil 2020-02-21 1628 have_sync = state->test_pattern || (sys_status & MASK_S_SYNC);
f51f9140626da0 Hans Verkuil 2020-02-21 1629 have_signal = have_5v && have_tmds && have_sync;
f51f9140626da0 Hans Verkuil 2020-02-21 1630 have_hdcp = have_signal ? (sys_status & MASK_S_HDCP) : false;
f51f9140626da0 Hans Verkuil 2020-02-21 1631
f51f9140626da0 Hans Verkuil 2020-02-21 1632 tc358840_check_5v(sd, have_5v);
f51f9140626da0 Hans Verkuil 2020-02-21 1633 if (have_hdcp) {
f51f9140626da0 Hans Verkuil 2020-02-21 1634 /*
f51f9140626da0 Hans Verkuil 2020-02-21 1635 * MASK_S_HDCP can be 1 for a short time when connecting
f51f9140626da0 Hans Verkuil 2020-02-21 1636 * or disconnecting: the HDCP authentication will kick in
f51f9140626da0 Hans Verkuil 2020-02-21 1637 * when that happens and thus MASK_S_HDCP becomes 1 until
f51f9140626da0 Hans Verkuil 2020-02-21 1638 * the authentication fails and it is cleared again.
f51f9140626da0 Hans Verkuil 2020-02-21 1639 *
f51f9140626da0 Hans Verkuil 2020-02-21 1640 * So if it is set, then double check that the HDCP_MODE
f51f9140626da0 Hans Verkuil 2020-02-21 1641 * is in manual authentication mode, because then we know
f51f9140626da0 Hans Verkuil 2020-02-21 1642 * the authentication will fail and this is just a glitch.
f51f9140626da0 Hans Verkuil 2020-02-21 1643 *
f51f9140626da0 Hans Verkuil 2020-02-21 1644 * Don't rely on some global setting, actually read the
f51f9140626da0 Hans Verkuil 2020-02-21 1645 * register here. This in case someone has been hacking.
f51f9140626da0 Hans Verkuil 2020-02-21 1646 */
f51f9140626da0 Hans Verkuil 2020-02-21 @1647 have_hdcp = !(i2c_rd8(sd, HDCP_MODE) &
f51f9140626da0 Hans Verkuil 2020-02-21 1648 MASK_MANUAL_AUTHENTICATION);
f51f9140626da0 Hans Verkuil 2020-02-21 1649 }
f51f9140626da0 Hans Verkuil 2020-02-21 1650
f51f9140626da0 Hans Verkuil 2020-02-21 1651 if (!have_5v) {
f51f9140626da0 Hans Verkuil 2020-02-21 1652 state->invalid_eq_bypass[0] = false;
f51f9140626da0 Hans Verkuil 2020-02-21 1653 state->invalid_eq_bypass[1] = false;
f51f9140626da0 Hans Verkuil 2020-02-21 1654 }
f51f9140626da0 Hans Verkuil 2020-02-21 1655 if (state->test_pattern) {
f51f9140626da0 Hans Verkuil 2020-02-21 1656 state->found_stable_signal = true;
f51f9140626da0 Hans Verkuil 2020-02-21 1657 state->status = STATUS_STABLE_SIGNAL;
f51f9140626da0 Hans Verkuil 2020-02-21 1658 } else {
f51f9140626da0 Hans Verkuil 2020-02-21 1659 u8 sys_int = i2c_rd8(sd, SYS_INT);
f51f9140626da0 Hans Verkuil 2020-02-21 1660 u8 clk_int = i2c_rd8(sd, CLK_INT);
f51f9140626da0 Hans Verkuil 2020-02-21 1661 u8 misc_int = i2c_rd8(sd, MISC_INT);
f51f9140626da0 Hans Verkuil 2020-02-21 1662 bool was_stable = state->found_stable_signal;
f51f9140626da0 Hans Verkuil 2020-02-21 1663
f51f9140626da0 Hans Verkuil 2020-02-21 1664 i2c_wr8(sd, MISC_INT, 0xff);
f51f9140626da0 Hans Verkuil 2020-02-21 1665 i2c_wr8(sd, CLK_INT, 0xff);
f51f9140626da0 Hans Verkuil 2020-02-21 1666 i2c_wr8(sd, SYS_INT, 0xff);
f51f9140626da0 Hans Verkuil 2020-02-21 1667 v4l2_dbg(2, debug, sd,
f51f9140626da0 Hans Verkuil 2020-02-21 1668 "%s: sys_stat: %02x misc_int: %02x clk_int: %02x sys_int: %02x eq_byps: %s\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1669 __func__, sys_status, misc_int, clk_int, sys_int,
f51f9140626da0 Hans Verkuil 2020-02-21 1670 state->eq_bypass ? "on" : "off");
f51f9140626da0 Hans Verkuil 2020-02-21 1671
f51f9140626da0 Hans Verkuil 2020-02-21 1672 if (!have_sync)
f51f9140626da0 Hans Verkuil 2020-02-21 1673 format_change |= 1;
f51f9140626da0 Hans Verkuil 2020-02-21 1674 if (sys_int & (MASK_DVI | MASK_HDMI))
f51f9140626da0 Hans Verkuil 2020-02-21 1675 format_change |= 2;
f51f9140626da0 Hans Verkuil 2020-02-21 1676 if (clk_int & (MASK_IN_DE_CHG))
f51f9140626da0 Hans Verkuil 2020-02-21 1677 format_change |= 4;
f51f9140626da0 Hans Verkuil 2020-02-21 1678 if (misc_int & (MASK_SYNC_CHG))
f51f9140626da0 Hans Verkuil 2020-02-21 1679 format_change |= 8;
f51f9140626da0 Hans Verkuil 2020-02-21 1680
f51f9140626da0 Hans Verkuil 2020-02-21 1681 if (sys_int & MASK_HDMI) {
f51f9140626da0 Hans Verkuil 2020-02-21 1682 v4l2_dbg(1, debug, sd, "%s: DVI->HDMI change detected\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1683 __func__);
f51f9140626da0 Hans Verkuil 2020-02-21 1684
f51f9140626da0 Hans Verkuil 2020-02-21 1685 i2c_wr8(sd, APPL_CTL, MASK_APLL_CPCTL_NORMAL | MASK_APLL_ON);
f51f9140626da0 Hans Verkuil 2020-02-21 1686 }
f51f9140626da0 Hans Verkuil 2020-02-21 1687 if (sys_int & MASK_DVI) {
f51f9140626da0 Hans Verkuil 2020-02-21 1688 v4l2_dbg(1, debug, sd, "%s: HDMI->DVI change detected\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1689 __func__);
f51f9140626da0 Hans Verkuil 2020-02-21 1690 }
f51f9140626da0 Hans Verkuil 2020-02-21 1691 if (!have_signal) {
f51f9140626da0 Hans Verkuil 2020-02-21 1692 if (state->status != STATUS_FIND_SIGNAL)
f51f9140626da0 Hans Verkuil 2020-02-21 1693 v4l2_info(sd, "no signal for EQ_BYPS %d\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1694 state->eq_bypass);
f51f9140626da0 Hans Verkuil 2020-02-21 1695 state->status = STATUS_FIND_SIGNAL;
f51f9140626da0 Hans Verkuil 2020-02-21 1696 state->found_signal_cnt[0] = 0;
f51f9140626da0 Hans Verkuil 2020-02-21 1697 state->found_signal_cnt[1] = 0;
f51f9140626da0 Hans Verkuil 2020-02-21 1698 if (state->enabled)
f51f9140626da0 Hans Verkuil 2020-02-21 1699 enable_stream(sd, false);
f51f9140626da0 Hans Verkuil 2020-02-21 1700 if (state->found_stable_signal) {
f51f9140626da0 Hans Verkuil 2020-02-21 1701 state->found_stable_signal = false;
f51f9140626da0 Hans Verkuil 2020-02-21 1702 v4l2_subdev_notify_event(sd, &tc358840_ev_fmt);
f51f9140626da0 Hans Verkuil 2020-02-21 1703 v4l2_info(sd, "event: no signal (SYS_STATUS 0x%02x)\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1704 sys_status);
f51f9140626da0 Hans Verkuil 2020-02-21 1705 }
f51f9140626da0 Hans Verkuil 2020-02-21 1706 state->detected_timings.bt.width = 0;
f51f9140626da0 Hans Verkuil 2020-02-21 1707 }
f51f9140626da0 Hans Verkuil 2020-02-21 1708 /*
f51f9140626da0 Hans Verkuil 2020-02-21 1709 * Reset the HDMI PHY to try to trigger proper lock on the
f51f9140626da0 Hans Verkuil 2020-02-21 1710 * incoming video format. Erase BKSV to prevent that old keys
f51f9140626da0 Hans Verkuil 2020-02-21 1711 * are used when a new source is connected.
f51f9140626da0 Hans Verkuil 2020-02-21 1712 */
f51f9140626da0 Hans Verkuil 2020-02-21 1713 if (have_5v && (format_change & 0xa) && !have_signal) {
f51f9140626da0 Hans Verkuil 2020-02-21 1714 if (have_tmds)
f51f9140626da0 Hans Verkuil 2020-02-21 1715 v4l2_dbg(was_stable ? 0 : 1, debug, sd,
f51f9140626da0 Hans Verkuil 2020-02-21 1716 "reset due to format_change (%x)\n",
f51f9140626da0 Hans Verkuil 2020-02-21 1717 format_change);
f51f9140626da0 Hans Verkuil 2020-02-21 1718 tc358840_reset_phy(sd);
f51f9140626da0 Hans Verkuil 2020-02-21 1719 }
f51f9140626da0 Hans Verkuil 2020-02-21 1720 }
f51f9140626da0 Hans Verkuil 2020-02-21 1721
f51f9140626da0 Hans Verkuil 2020-02-21 1722 if (have_signal) {
f51f9140626da0 Hans Verkuil 2020-02-21 1723 struct v4l2_dv_timings timings = { };
f51f9140626da0 Hans Verkuil 2020-02-21 1724
f51f9140626da0 Hans Verkuil 2020-02-21 1725 /*
f51f9140626da0 Hans Verkuil 2020-02-21 1726 * If we don't have detected_timings, or something changed, then
f51f9140626da0 Hans Verkuil 2020-02-21 1727 * detect timings.
f51f9140626da0 Hans Verkuil 2020-02-21 1728 */
f51f9140626da0 Hans Verkuil 2020-02-21 1729 if (format_change || !state->detected_timings.bt.width)
f51f9140626da0 Hans Verkuil 2020-02-21 1730 tc358840_get_detected_timings(sd, &timings);
f51f9140626da0 Hans Verkuil 2020-02-21 1731 else
f51f9140626da0 Hans Verkuil 2020-02-21 1732 timings = state->detected_timings;
f51f9140626da0 Hans Verkuil 2020-02-21 1733
f51f9140626da0 Hans Verkuil 2020-02-21 1734 /*
f51f9140626da0 Hans Verkuil 2020-02-21 1735 * Store newly detected timings (if any) if we detect timings
f51f9140626da0 Hans Verkuil 2020-02-21 1736 * for the first time, or if the sync toggled, or if the
f51f9140626da0 Hans Verkuil 2020-02-21 1737 * DVI/HDMI mode changed.
f51f9140626da0 Hans Verkuil 2020-02-21 1738 */
f51f9140626da0 Hans Verkuil 2020-02-21 1739 if (!state->detected_timings.bt.width || (format_change & 3)) {
f51f9140626da0 Hans Verkuil 2020-02-21 1740 state->detected_timings = timings;
f51f9140626da0 Hans Verkuil 2020-02-21 1741 /*
f51f9140626da0 Hans Verkuil 2020-02-21 1742 * Silently accept SYNC/DE changes if the timings stay the same,
f51f9140626da0 Hans Verkuil 2020-02-21 1743 * i.e. if only blanking changed.
f51f9140626da0 Hans Verkuil 2020-02-21 1744 */
f51f9140626da0 Hans Verkuil 2020-02-21 1745 } else if (format_change &&
f51f9140626da0 Hans Verkuil 2020-02-21 1746 tc358840_match_dv_timings(&state->detected_timings,
f51f9140626da0 Hans Verkuil 2020-02-21 1747 &timings, 250000)) {
f51f9140626da0 Hans Verkuil 2020-02-21 1748 v4l2_dbg(1, debug, sd, "ignore timings change\n");
f51f9140626da0 Hans Verkuil 2020-02-21 1749 format_change = 0;
f51f9140626da0 Hans Verkuil 2020-02-21 1750 } else {
f51f9140626da0 Hans Verkuil 2020-02-21 1751 state->detected_timings = timings;
f51f9140626da0 Hans Verkuil 2020-02-21 1752 }
f51f9140626da0 Hans Verkuil 2020-02-21 1753 have_signal = state->detected_timings.bt.width;
f51f9140626da0 Hans Verkuil 2020-02-21 1754 }
f51f9140626da0 Hans Verkuil 2020-02-21 1755
f51f9140626da0 Hans Verkuil 2020-02-21 1756 if (!state->test_pattern && have_5v) {
f51f9140626da0 Hans Verkuil 2020-02-21 1757 switch (state->status) {
f51f9140626da0 Hans Verkuil 2020-02-21 1758 case STATUS_FIND_SIGNAL:
f51f9140626da0 Hans Verkuil 2020-02-21 1759 tc358840_find_signal(sd, have_signal);
f51f9140626da0 Hans Verkuil 2020-02-21 1760 break;
f51f9140626da0 Hans Verkuil 2020-02-21 1761 case STATUS_FOUND_SIGNAL:
f51f9140626da0 Hans Verkuil 2020-02-21 1762 tc358840_found_signal(sd, have_signal, format_change);
f51f9140626da0 Hans Verkuil 2020-02-21 1763 break;
f51f9140626da0 Hans Verkuil 2020-02-21 1764 case STATUS_STABLE_SIGNAL:
f51f9140626da0 Hans Verkuil 2020-02-21 1765 tc358840_format_change(sd, have_signal, format_change);
f51f9140626da0 Hans Verkuil 2020-02-21 1766 break;
f51f9140626da0 Hans Verkuil 2020-02-21 1767 }
f51f9140626da0 Hans Verkuil 2020-02-21 1768 }
f51f9140626da0 Hans Verkuil 2020-02-21 1769 mutex_unlock(&state->lock);
f51f9140626da0 Hans Verkuil 2020-02-21 1770 v4l2_ctrl_s_ctrl(state->tmds_present_ctrl, have_signal);
f51f9140626da0 Hans Verkuil 2020-02-21 1771 v4l2_ctrl_s_ctrl(state->detect_tx_5v_ctrl, have_5v);
f51f9140626da0 Hans Verkuil 2020-02-21 1772 v4l2_ctrl_s_ctrl(state->audio_present_ctrl, audio_present(sd));
f51f9140626da0 Hans Verkuil 2020-02-21 1773
f51f9140626da0 Hans Verkuil 2020-02-21 1774 if (have_signal)
f51f9140626da0 Hans Verkuil 2020-02-21 1775 v4l2_ctrl_s_ctrl(state->audio_sampling_rate_ctrl,
f51f9140626da0 Hans Verkuil 2020-02-21 1776 get_audio_sampling_rate(sd));
f51f9140626da0 Hans Verkuil 2020-02-21 1777
f51f9140626da0 Hans Verkuil 2020-02-21 1778 if (!state->delayed_work_stop_polling)
f51f9140626da0 Hans Verkuil 2020-02-21 1779 schedule_delayed_work(&state->delayed_work_poll, POLL_PERIOD);
f51f9140626da0 Hans Verkuil 2020-02-21 1780 }
f51f9140626da0 Hans Verkuil 2020-02-21 1781
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists