sound/soc/fsl/fsl_xcvr.c:1048:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]

From: kernel test robot
Date: Thu Aug 19 2021 - 22:26:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d992fe5318d8d7af9510b879439a3c7f283da442
commit: 28564486866fa889b78264360022c94836fa8072 ASoC: fsl_xcvr: Add XCVR ASoC CPU DAI driver
date: 10 months ago
config: arm-randconfig-c002-20210816 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=28564486866fa889b78264360022c94836fa8072
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 28564486866fa889b78264360022c94836fa8072
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)
include/linux/minmax.h:130:36: note: expanded from macro 'clamp_t'
#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:110:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:34:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^~~
drivers/hwmon/lm75.h:27:14: note: '?' condition is true
int ntemp = clamp_val(temp, LM75_TEMP_MIN, LM75_TEMP_MAX);
^
include/linux/minmax.h:143:32: note: expanded from macro 'clamp_val'
#define clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
^
include/linux/minmax.h:130:36: note: expanded from macro 'clamp_t'
#define clamp_t(type, val, lo, hi) min_t(type, max_t(type, val, lo), hi)
^
include/linux/minmax.h:110:27: note: expanded from macro 'min_t'
#define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
^
include/linux/minmax.h:44:3: note: expanded from macro '__careful_cmp'
__cmp_once(x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y), op))
^
include/linux/minmax.h:39:3: note: expanded from macro '__cmp_once'
__cmp(unique_x, unique_y, op); })
^
include/linux/minmax.h:34:26: note: expanded from macro '__cmp'
#define __cmp(x, y, op) ((x) op (y) ? (x) : (y))
^
drivers/hwmon/lm75.h:29:12: note: 'ntemp' is < 0
ntemp += (ntemp < 0 ? -250 : 250);
^~~~~
drivers/hwmon/lm75.h:29:12: note: '?' condition is true
drivers/hwmon/lm75.h:30:29: note: The result of the left shift is undefined because the left operand is negative
return (u16)((ntemp / 500) << 7);
~~~~~~~~~~~~~ ^
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
2 warnings generated.
Suppressed 2 warnings (2 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
10 warnings generated.
sound/soc/fsl/fsl_spdif.c:153:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:153:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:169:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:169:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:221:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:221:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:238:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:238:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:270:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:270:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:372:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:372:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:844:26: warning: Value stored to 'pdev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_spdif.c:844:26: note: Value stored to 'pdev' during its initialization is never read
struct platform_device *pdev = spdif_priv->pdev;
^~~~ ~~~~~~~~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
>> sound/soc/fsl/fsl_xcvr.c:1048:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = &xcvr->pdev->dev;
^~~ ~~~~~~~~~~~~~~~~
sound/soc/fsl/fsl_xcvr.c:1048:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = &xcvr->pdev->dev;
^~~ ~~~~~~~~~~~~~~~~
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings generated.
Suppressed 3 warnings (3 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4 warnings generated.
sound/soc/img/img-spdif-in.c:787:30: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
reg |= (spdif->lock_release << IMG_SPDIF_IN_CTL_LOCKLO_SHIFT) &
~~~~~~~~~~~~~~~~~~~ ^
sound/soc/img/img-spdif-in.c:728:6: note: Assuming 'spdif' is non-null
if (!spdif)
^~~~~~
sound/soc/img/img-spdif-in.c:728:2: note: Taking false branch
if (!spdif)
^
sound/soc/img/img-spdif-in.c:731:2: note: Calling 'platform_set_drvdata'
platform_set_drvdata(pdev, spdif);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/platform_device.h:239:2: note: Calling 'dev_set_drvdata'
dev_set_drvdata(&pdev->dev, data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:663:1: note: Returning without writing to 'data->lock_release'
}
^
include/linux/platform_device.h:239:2: note: Returning from 'dev_set_drvdata'
dev_set_drvdata(&pdev->dev, data);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/platform_device.h:240:1: note: Returning without writing to 'data->lock_release'
}
^
sound/soc/img/img-spdif-in.c:731:2: note: Returning from 'platform_set_drvdata'
platform_set_drvdata(pdev, spdif);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:737:6: note: Calling 'IS_ERR'
if (IS_ERR(base))
^~~~~~~~~~~~
include/linux/err.h:36:9: note: Assuming the condition is false
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:737:6: note: Returning from 'IS_ERR'
if (IS_ERR(base))
^~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:737:2: note: Taking false branch
if (IS_ERR(base))
^
sound/soc/img/img-spdif-in.c:743:6: note: Calling 'IS_ERR'
if (IS_ERR(spdif->clk_sys)) {
^~~~~~~~~~~~~~~~~~~~~~
include/linux/err.h:36:9: note: Assuming the condition is false
return IS_ERR_VALUE((unsigned long)ptr);
^
include/linux/err.h:22:34: note: expanded from macro 'IS_ERR_VALUE'
#define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
include/linux/err.h:36:2: note: Returning zero, which participates in a condition later
return IS_ERR_VALUE((unsigned long)ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:743:6: note: Returning from 'IS_ERR'
if (IS_ERR(spdif->clk_sys)) {
^~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:743:2: note: Taking false branch
if (IS_ERR(spdif->clk_sys)) {
^
sound/soc/img/img-spdif-in.c:750:7: note: Calling 'pm_runtime_enabled'
if (!pm_runtime_enabled(&pdev->dev)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/pm_runtime.h:263:61: note: Returning zero, which participates in a condition later
static inline bool pm_runtime_enabled(struct device *dev) { return false; }
^~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:750:7: note: Returning from 'pm_runtime_enabled'
if (!pm_runtime_enabled(&pdev->dev)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:750:2: note: Taking true branch
if (!pm_runtime_enabled(&pdev->dev)) {
^
sound/soc/img/img-spdif-in.c:751:9: note: Calling 'img_spdif_in_runtime_resume'
ret = img_spdif_in_runtime_resume(&pdev->dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/img/img-spdif-in.c:104:8: note: Calling 'clk_prepare_enable'
ret = clk_prepare_enable(spdif->clk_sys);

vim +/dev +1048 sound/soc/fsl/fsl_xcvr.c

1044
1045 static irqreturn_t irq0_isr(int irq, void *devid)
1046 {
1047 struct fsl_xcvr *xcvr = (struct fsl_xcvr *)devid;
> 1048 struct device *dev = &xcvr->pdev->dev;
1049 struct regmap *regmap = xcvr->regmap;
1050 void __iomem *reg_ctrl, *reg_buff;
1051 u32 isr, isr_clr = 0, val, i;
1052
1053 regmap_read(regmap, FSL_XCVR_EXT_ISR, &isr);
1054
1055 if (isr & FSL_XCVR_IRQ_NEW_CS) {
1056 dev_dbg(dev, "Received new CS block\n");
1057 isr_clr |= FSL_XCVR_IRQ_NEW_CS;
1058 /* Data RAM is 4KiB, last two pages: 8 and 9. Select page 8. */
1059 regmap_update_bits(xcvr->regmap, FSL_XCVR_EXT_CTRL,
1060 FSL_XCVR_EXT_CTRL_PAGE_MASK,
1061 FSL_XCVR_EXT_CTRL_PAGE(8));
1062
1063 /* Find updated CS buffer */
1064 reg_ctrl = xcvr->ram_addr + FSL_XCVR_RX_CS_CTRL_0;
1065 reg_buff = xcvr->ram_addr + FSL_XCVR_RX_CS_BUFF_0;
1066 memcpy_fromio(&val, reg_ctrl, sizeof(val));
1067 if (!val) {
1068 reg_ctrl = xcvr->ram_addr + FSL_XCVR_RX_CS_CTRL_1;
1069 reg_buff = xcvr->ram_addr + FSL_XCVR_RX_CS_BUFF_1;
1070 memcpy_fromio(&val, reg_ctrl, sizeof(val));
1071 }
1072
1073 if (val) {
1074 /* copy CS buffer */
1075 memcpy_fromio(&xcvr->rx_iec958.status, reg_buff,
1076 sizeof(xcvr->rx_iec958.status));
1077 for (i = 0; i < 6; i++) {
1078 val = *(u32 *)(xcvr->rx_iec958.status + i*4);
1079 *(u32 *)(xcvr->rx_iec958.status + i*4) =
1080 bitrev32(val);
1081 }
1082 /* clear CS control register */
1083 memset_io(reg_ctrl, 0, sizeof(val));
1084 }
1085 }
1086 if (isr & FSL_XCVR_IRQ_NEW_UD) {
1087 dev_dbg(dev, "Received new UD block\n");
1088 isr_clr |= FSL_XCVR_IRQ_NEW_UD;
1089 }
1090 if (isr & FSL_XCVR_IRQ_MUTE) {
1091 dev_dbg(dev, "HW mute bit detected\n");
1092 isr_clr |= FSL_XCVR_IRQ_MUTE;
1093 }
1094 if (isr & FSL_XCVR_IRQ_FIFO_UOFL_ERR) {
1095 dev_dbg(dev, "RX/TX FIFO full/empty\n");
1096 isr_clr |= FSL_XCVR_IRQ_FIFO_UOFL_ERR;
1097 }
1098 if (isr & FSL_XCVR_IRQ_ARC_MODE) {
1099 dev_dbg(dev, "CMDC SM falls out of eARC mode\n");
1100 isr_clr |= FSL_XCVR_IRQ_ARC_MODE;
1101 }
1102 if (isr & FSL_XCVR_IRQ_DMA_RD_REQ) {
1103 dev_dbg(dev, "DMA read request\n");
1104 isr_clr |= FSL_XCVR_IRQ_DMA_RD_REQ;
1105 }
1106 if (isr & FSL_XCVR_IRQ_DMA_WR_REQ) {
1107 dev_dbg(dev, "DMA write request\n");
1108 isr_clr |= FSL_XCVR_IRQ_DMA_WR_REQ;
1109 }
1110
1111 if (isr_clr) {
1112 regmap_write(regmap, FSL_XCVR_EXT_ISR_CLR, isr_clr);
1113 return IRQ_HANDLED;
1114 }
1115
1116 return IRQ_NONE;
1117 }
1118

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip