Re: [PATCH v2] scsi: be2iscsi: Replace irq_poll with threaded IRQ handler.
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211029074902.4fayed6mcltifgdz(a)linutronix.de>
References: <20211029074902.4fayed6mcltifgdz(a)linutronix.de>
TO: Sebastian Andrzej Siewior <bigeasy(a)linutronix.de>
TO: linux-scsi(a)vger.kernel.org
TO: Ketan Mukadam <ketan.mukadam(a)broadcom.com>
CC: "James E.J. Bottomley" <jejb(a)linux.ibm.com>
CC: "Martin K. Petersen" <martin.petersen(a)oracle.com>
CC: Thomas Gleixner <tglx(a)linutronix.de>
Hi Sebastian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sebastian-Andrzej-Siewior/scsi-b...
base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-c001-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224)
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
# https://github.com/0day-ci/linux/commit/66895bb3d61cae1257df8eb153ea1a6c9...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sebastian-Andrzej-Siewior/scsi-be2iscsi-Replace-irq_poll-with-threaded-IRQ-handler/20211029-155031
git checkout 66895bb3d61cae1257df8eb153ea1a6c9dda075a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is true. Entering loop body
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) {
^
drivers/scsi/be2iscsi/be_main.c:3738:7: note: Assuming the condition is false
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3738:3: note: Taking false branch
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^
drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is true. Entering loop body
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) {
^
drivers/scsi/be2iscsi/be_main.c:3738:7: note: Assuming the condition is false
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3738:3: note: Taking false branch
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^
drivers/scsi/be2iscsi/be_main.c:3737:2: note: Loop condition is false. Execution continues on line 3774
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) {
^
drivers/scsi/be2iscsi/be_main.c:3775:6: note: 'status' is equal to 0
if (status != 0) {
^~~~~~
drivers/scsi/be2iscsi/be_main.c:3775:2: note: Taking false branch
if (status != 0) {
^
drivers/scsi/be2iscsi/be_main.c:3782:6: note: 'status' is equal to 0
if (status != 0) {
^~~~~~
drivers/scsi/be2iscsi/be_main.c:3782:2: note: Taking false branch
if (status != 0) {
^
drivers/scsi/be2iscsi/be_main.c:3787:11: note: Calling 'beiscsi_create_wrb_rings'
status = beiscsi_create_wrb_rings(phba, phwi_context, phwi_ctrlr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3363:6: note: Assuming 'pwrb_arr' is non-null
if (!pwrb_arr) {
^~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3363:2: note: Taking false branch
if (!pwrb_arr) {
^
drivers/scsi/be2iscsi/be_main.c:3373:16: note: Assuming 'num' is < field 'cxns_per_ctrl'
for (num = 0; num < phba->params.cxns_per_ctrl; num++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3373:2: note: Loop condition is true. Entering loop body
for (num = 0; num < phba->params.cxns_per_ctrl; num++) {
^
drivers/scsi/be2iscsi/be_main.c:3374:7: note: Assuming 'num_wrb_rings' is 0
if (num_wrb_rings) {
^~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3374:3: note: Taking false branch
if (num_wrb_rings) {
^
drivers/scsi/be2iscsi/be_main.c:3373:16: note: Assuming 'num' is >= field 'cxns_per_ctrl'
for (num = 0; num < phba->params.cxns_per_ctrl; num++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3373:2: note: Loop condition is false. Execution continues on line 3401
for (num = 0; num < phba->params.cxns_per_ctrl; num++) {
^
drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is true. Entering loop body
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
^
drivers/scsi/be2iscsi/be_main.c:3402:7: note: Assuming the condition is false
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3402:3: note: Taking false branch
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^
drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is true. Entering loop body
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
^
drivers/scsi/be2iscsi/be_main.c:3402:7: note: Assuming the condition is false
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3402:3: note: Taking false branch
if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) {
^
drivers/scsi/be2iscsi/be_main.c:3401:2: note: Loop condition is false. Execution continues on line 3409
for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++)
^
drivers/scsi/be2iscsi/be_main.c:3409:2: note: Loop condition is true. Entering loop body
for (i = 0; i < phba->params.cxns_per_ctrl; i++) {
^
drivers/scsi/be2iscsi/be_main.c:3410:7: note: 'ulp_count' is <= 1
if (ulp_count > 1) {
^~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:3410:3: note: Taking false branch
if (ulp_count > 1) {
^
drivers/scsi/be2iscsi/be_main.c:3421:3: note: Calling 'hwi_build_be_sgl_by_offset'
hwi_build_be_sgl_by_offset(phba, &pwrb_arr[i], &sgl);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:2981:6: note: Branch condition evaluates to a garbage value
if (sgl->va)
^~~~~~~
drivers/scsi/be2iscsi/be_main.c:4843:3: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
rc = wait_event_interruptible_timeout(
^
drivers/scsi/be2iscsi/be_main.c:4843:3: note: Value stored to 'rc' is never read
>> drivers/scsi/be2iscsi/be_main.c:5392:13: warning: Array subscript is undefined [clang-analyzer-core.uninitialized.ArraySubscript]
pbe_eq = &phwi_context->be_eq[i];
^
drivers/scsi/be2iscsi/be_main.c:5416:9: note: Left side of '&&' is false
phba = container_of(work, struct beiscsi_hba, recover_port.work);
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/scsi/be2iscsi/be_main.c:5416:9: note: Taking false branch
phba = container_of(work, struct beiscsi_hba, recover_port.work);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/scsi/be2iscsi/be_main.c:5416:9: note: Loop condition is false. Exiting loop
phba = container_of(work, struct beiscsi_hba, recover_port.work);
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
drivers/scsi/be2iscsi/be_main.c:5417:2: note: Calling 'beiscsi_disable_port'
beiscsi_disable_port(phba, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:5377:2: note: 'i' declared without an initial value
unsigned int i;
^~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:5379:6: note: Assuming the condition is false
if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:5379:2: note: Taking false branch
if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state))
^
drivers/scsi/be2iscsi/be_main.c:5391:7: note: 'unload' is 0
if (!unload && beiscsi_hba_in_error(phba)) {
^~~~~~
drivers/scsi/be2iscsi/be_main.c:5391:6: note: Left side of '&&' is true
if (!unload && beiscsi_hba_in_error(phba)) {
^
drivers/scsi/be2iscsi/be_main.c:5391:17: note: Assuming the condition is true
if (!unload && beiscsi_hba_in_error(phba)) {
^
drivers/scsi/be2iscsi/be_main.h:395:37: note: expanded from macro 'beiscsi_hba_in_error'
#define beiscsi_hba_in_error(phba) ((phba)->state & BEISCSI_HBA_IN_ERR)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/be2iscsi/be_main.c:5391:2: note: Taking true branch
if (!unload && beiscsi_hba_in_error(phba)) {
^
drivers/scsi/be2iscsi/be_main.c:5392:13: note: Array subscript is undefined
pbe_eq = &phwi_context->be_eq[i];
^ ~
Suppressed 5 warnings (4 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5 warnings generated.
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:160:2: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn]
return ret;
^ ~~~
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:145:2: note: 'ret' declared without an initial value
int ret;
^~~~~~~
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:147:6: note: Assuming 'blob' is non-null
if (!blob)
^~~~~
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:147:2: note: Taking false branch
if (!blob)
^
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:154:7: note: Calling 'intel_guc_is_ready'
if (!intel_guc_is_ready(guc))
^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/gt/uc/intel_guc.h:232:9: note: Left side of '&&' is true
return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct);
^
drivers/gpu/drm/i915/gt/uc/intel_guc.h:232:2: note: Returning value, which participates in a condition later
return intel_guc_is_fw_running(guc) && intel_guc_ct_enabled(&guc->ct);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:154:7: note: Returning from 'intel_guc_is_ready'
if (!intel_guc_is_ready(guc))
vim +5392 drivers/scsi/be2iscsi/be_main.c
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5363
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5364 /*
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5365 * beiscsi_disable_port()- Disable port and cleanup driver resources.
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5366 * This is called in HBA error handling and driver removal.
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5367 * @phba: Instance Priv structure
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5368 * @unload: indicate driver is unloading
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5369 *
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5370 * Free the OS and HW resources held by the driver
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5371 **/
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5372 static void beiscsi_disable_port(struct beiscsi_hba *phba, int unload)
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5373 {
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5374 struct hwi_context_memory *phwi_context;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5375 struct hwi_controller *phwi_ctrlr;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5376 struct be_eq_obj *pbe_eq;
831488669a334e Christoph Hellwig 2017-01-13 5377 unsigned int i;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5378
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5379 if (!test_and_clear_bit(BEISCSI_HBA_ONLINE, &phba->state))
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5380 return;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5381
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5382 phwi_ctrlr = phba->phwi_ctrlr;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5383 phwi_context = phwi_ctrlr->phwi_ctxt;
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5384 hwi_disable_intr(phba);
45371aa398c647 Jitendra Bhivare 2017-10-10 5385 beiscsi_free_irqs(phba);
831488669a334e Christoph Hellwig 2017-01-13 5386 pci_free_irq_vectors(phba->pcidev);
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5387
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5388 cancel_delayed_work_sync(&phba->eqd_update);
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5389 cancel_work_sync(&phba->boot_work);
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5390 /* WQ might be running cancel queued mcc_work if we are not exiting */
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5391 if (!unload && beiscsi_hba_in_error(phba)) {
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 @5392 pbe_eq = &phwi_context->be_eq[i];
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5393 cancel_work_sync(&pbe_eq->mcc_work);
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5394 }
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5395 hwi_cleanup_port(phba);
dd940972f36779 Jitendra Bhivare 2016-12-13 5396 beiscsi_cleanup_port(phba);
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5397 }
d1d5ca887c0ee6 Jitendra Bhivare 2016-08-19 5398
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 3 weeks
[djwong-xfs:vectorized-scrub 45/312] fs/xfs/libxfs/xfs_bmap_btree.c:646:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong(a)oracle.com>
CC: linux-kernel(a)vger.kernel.org
TO: "Darrick J. Wong" <djwong(a)kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git vectorized-scrub
head: 1804f4671b76293a8a792e5be4e514cefc0f012f
commit: ebbf385a912f3d1e5c13d7e33101e8aefb300f15 [45/312] xfs: repair inode block maps
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
config: arm-randconfig-c002-20211031 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224)
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/djwong/xfs-linux.git/comm...
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs vectorized-scrub
git checkout ebbf385a912f3d1e5c13d7e33101e8aefb300f15
# 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(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^~~~~~~~~~~~~~~~~~~~
include/linux/dcache.h:526:9: note: Access to field 'd_inode' results in a dereference of a null pointer (loaded from variable 'dentry')
return dentry->d_inode;
^~~~~~
Suppressed 17 warnings (17 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.
17 warnings generated.
Suppressed 17 warnings (17 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.
18 warnings generated.
drivers/dma-buf/dma-resv.c:485:26: warning: Array access (from variable 'shared') results in a null pointer dereference [clang-analyzer-core.NullDereference]
shared[shared_count++] = fence_excl;
~~~~~~ ^
drivers/dma-buf/dma-resv.c:415:2: note: 'shared' initialized to a null pointer value
struct dma_fence **shared = NULL;
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/dma-buf/dma-resv.c:428:9: note: Loop condition is false. Execution continues on line 428
seq = read_seqcount_begin(&obj->seq);
^
include/linux/seqlock.h:363:2: note: expanded from macro 'read_seqcount_begin'
raw_read_seqcount_begin(s); \
^
include/linux/seqlock.h:348:18: note: expanded from macro 'raw_read_seqcount_begin'
unsigned _seq = __read_seqcount_begin(s); \
^
include/linux/seqlock.h:333:2: note: expanded from macro '__read_seqcount_begin'
while ((__seq = seqprop_sequence(s)) & 1) \
^
drivers/dma-buf/dma-resv.c:431:7: note: Assuming 'fence_excl' is non-null
if (fence_excl && !dma_fence_get_rcu(fence_excl))
^~~~~~~~~~
drivers/dma-buf/dma-resv.c:431:7: note: Left side of '&&' is true
drivers/dma-buf/dma-resv.c:431:3: note: Taking false branch
if (fence_excl && !dma_fence_get_rcu(fence_excl))
^
drivers/dma-buf/dma-resv.c:435:7: note: Assuming 'fobj' is non-null
if (fobj)
^~~~
drivers/dma-buf/dma-resv.c:435:3: note: Taking true branch
if (fobj)
^
drivers/dma-buf/dma-resv.c:438:7: note: Assuming 'pfence_excl' is null
if (!pfence_excl && fence_excl)
^~~~~~~~~~~~
drivers/dma-buf/dma-resv.c:438:7: note: Left side of '&&' is true
drivers/dma-buf/dma-resv.c:438:23: note: 'fence_excl' is non-null
if (!pfence_excl && fence_excl)
^~~~~~~~~~
drivers/dma-buf/dma-resv.c:438:3: note: Taking true branch
if (!pfence_excl && fence_excl)
^
drivers/dma-buf/dma-resv.c:441:7: note: Assuming 'sz' is 0
if (sz) {
^~
drivers/dma-buf/dma-resv.c:441:3: note: Taking false branch
if (sz) {
^
drivers/dma-buf/dma-resv.c:470:7: note: 'i' is equal to 'shared_count'
if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
^
drivers/dma-buf/dma-resv.c:470:7: note: Left side of '||' is false
drivers/dma-buf/dma-resv.c:470:3: note: Taking false branch
if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) {
^
drivers/dma-buf/dma-resv.c:420:2: note: Loop condition is false. Exiting loop
do {
^
drivers/dma-buf/dma-resv.c:482:6: note: 'pfence_excl' is null
if (pfence_excl)
^~~~~~~~~~~
drivers/dma-buf/dma-resv.c:482:2: note: Taking false branch
if (pfence_excl)
^
drivers/dma-buf/dma-resv.c:484:11: note: 'fence_excl' is non-null
else if (fence_excl)
^~~~~~~~~~
drivers/dma-buf/dma-resv.c:484:7: note: Taking true branch
else if (fence_excl)
^
drivers/dma-buf/dma-resv.c:485:26: note: Array access (from variable 'shared') results in a null pointer dereference
shared[shared_count++] = fence_excl;
~~~~~~ ^
Suppressed 17 warnings (17 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.
21 warnings generated.
fs/xfs/libxfs/xfs_bmap.c:850:2: warning: Value stored to 'error' is never read [clang-analyzer-deadcode.DeadStores]
error = 0;
^ ~
fs/xfs/libxfs/xfs_bmap.c:850:2: note: Value stored to 'error' is never read
error = 0;
^ ~
fs/xfs/libxfs/xfs_bmap.c:5082:2: warning: Value stored to 'qfield' is never read [clang-analyzer-deadcode.DeadStores]
qfield = 0;
^ ~
fs/xfs/libxfs/xfs_bmap.c:5082:2: note: Value stored to 'qfield' is never read
qfield = 0;
^ ~
Suppressed 19 warnings (18 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
20 warnings generated.
>> fs/xfs/libxfs/xfs_bmap_btree.c:646:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
flags |= extflag[whichfork];
^ ~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: Assuming the condition is false
ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
^
fs/xfs/xfs_linux.h:214:3: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
^~~~~~~~~~~~
include/linux/compiler.h:77:38: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^~~~
fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: '?' condition is true
ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
^
fs/xfs/xfs_linux.h:214:3: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
^
include/linux/compiler.h:77:20: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/libxfs/xfs_bmap_btree.c:633:9: note: Assuming 'whichfork' is equal to 2
ASSERT(whichfork != XFS_COW_FORK);
^
fs/xfs/xfs_linux.h:214:10: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
~~~~~~~^~~~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/libxfs/xfs_bmap_btree.c:633:2: note: '?' condition is false
ASSERT(whichfork != XFS_COW_FORK);
^
fs/xfs/xfs_linux.h:214:3: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
^
include/linux/compiler.h:77:20: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: 'whichfork' is not equal to 0
ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
^
fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 'XFS_IFORK_PTR'
((w) == XFS_DATA_FORK ? \
^~~
fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: '?' condition is false
ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
^
fs/xfs/libxfs/xfs_inode_fork.h:98:3: note: expanded from macro 'XFS_IFORK_PTR'
((w) == XFS_DATA_FORK ? \
^
fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: 'whichfork' is not equal to 1
ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
^
fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 'XFS_IFORK_PTR'
((w) == XFS_ATTR_FORK ? \
^~~
fs/xfs/libxfs/xfs_bmap_btree.c:640:8: note: '?' condition is false
ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
^
fs/xfs/libxfs/xfs_inode_fork.h:100:4: note: expanded from macro 'XFS_IFORK_PTR'
((w) == XFS_ATTR_FORK ? \
^
fs/xfs/libxfs/xfs_bmap_btree.c:644:2: note: Control jumps to 'case XFS_DINODE_FMT_EXTENTS:' at line 645
switch (ifp->if_format) {
^
fs/xfs/libxfs/xfs_bmap_btree.c:646:9: note: Assigned value is garbage or undefined
flags |= extflag[whichfork];
^ ~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_bmap_btree.c:649:9: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]
flags |= brootflag[whichfork];
^ ~~~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: Assuming the condition is false
ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
^
fs/xfs/xfs_linux.h:214:3: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
^~~~~~~~~~~~
include/linux/compiler.h:77:38: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^~~~
fs/xfs/libxfs/xfs_bmap_btree.c:632:2: note: '?' condition is true
ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
^
fs/xfs/xfs_linux.h:214:3: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
^
include/linux/compiler.h:77:20: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/libxfs/xfs_bmap_btree.c:633:9: note: Assuming 'whichfork' is equal to 2
ASSERT(whichfork != XFS_COW_FORK);
^
fs/xfs/xfs_linux.h:214:10: note: expanded from macro 'ASSERT'
(likely(expr) ? (void)0 : asswarn(NULL, #expr, __FILE__, __LINE__))
~~~~~~~^~~~~
include/linux/compiler.h:77:40: note: expanded from macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/libxfs/xfs_bmap_btree.c:633:2: note: '?' condition is false
ASSERT(whichfork != XFS_COW_FORK);
vim +646 fs/xfs/libxfs/xfs_bmap_btree.c
ebbf385a912f3d Darrick J. Wong 2021-09-01 613
ebbf385a912f3d Darrick J. Wong 2021-09-01 614 /*
ebbf385a912f3d Darrick J. Wong 2021-09-01 615 * Swap in the new inode fork root. Once we pass this point the newly rebuilt
ebbf385a912f3d Darrick J. Wong 2021-09-01 616 * mappings are in place and we have to kill off any old btree blocks.
ebbf385a912f3d Darrick J. Wong 2021-09-01 617 */
ebbf385a912f3d Darrick J. Wong 2021-09-01 618 void
ebbf385a912f3d Darrick J. Wong 2021-09-01 619 xfs_bmbt_commit_staged_btree(
ebbf385a912f3d Darrick J. Wong 2021-09-01 620 struct xfs_btree_cur *cur,
ebbf385a912f3d Darrick J. Wong 2021-09-01 621 struct xfs_trans *tp,
ebbf385a912f3d Darrick J. Wong 2021-09-01 622 int whichfork)
ebbf385a912f3d Darrick J. Wong 2021-09-01 623 {
ebbf385a912f3d Darrick J. Wong 2021-09-01 624 struct xbtree_ifakeroot *ifake = cur->bc_ino.ifake;
ebbf385a912f3d Darrick J. Wong 2021-09-01 625 struct xfs_ifork *ifp;
ebbf385a912f3d Darrick J. Wong 2021-09-01 626 static const short brootflag[2] =
ebbf385a912f3d Darrick J. Wong 2021-09-01 627 { XFS_ILOG_DBROOT, XFS_ILOG_ABROOT };
ebbf385a912f3d Darrick J. Wong 2021-09-01 628 static const short extflag[2] =
ebbf385a912f3d Darrick J. Wong 2021-09-01 629 { XFS_ILOG_DEXT, XFS_ILOG_AEXT };
ebbf385a912f3d Darrick J. Wong 2021-09-01 630 int flags = XFS_ILOG_CORE;
ebbf385a912f3d Darrick J. Wong 2021-09-01 631
ebbf385a912f3d Darrick J. Wong 2021-09-01 632 ASSERT(cur->bc_flags & XFS_BTREE_STAGING);
ebbf385a912f3d Darrick J. Wong 2021-09-01 633 ASSERT(whichfork != XFS_COW_FORK);
ebbf385a912f3d Darrick J. Wong 2021-09-01 634
ebbf385a912f3d Darrick J. Wong 2021-09-01 635 /*
ebbf385a912f3d Darrick J. Wong 2021-09-01 636 * Free any resources hanging off the real fork, then shallow-copy the
ebbf385a912f3d Darrick J. Wong 2021-09-01 637 * staging fork's contents into the real fork to transfer everything
ebbf385a912f3d Darrick J. Wong 2021-09-01 638 * we just built.
ebbf385a912f3d Darrick J. Wong 2021-09-01 639 */
ebbf385a912f3d Darrick J. Wong 2021-09-01 640 ifp = XFS_IFORK_PTR(cur->bc_ino.ip, whichfork);
ebbf385a912f3d Darrick J. Wong 2021-09-01 641 xfs_idestroy_fork(ifp);
ebbf385a912f3d Darrick J. Wong 2021-09-01 642 memcpy(ifp, ifake->if_fork, sizeof(struct xfs_ifork));
ebbf385a912f3d Darrick J. Wong 2021-09-01 643
ebbf385a912f3d Darrick J. Wong 2021-09-01 644 switch (ifp->if_format) {
ebbf385a912f3d Darrick J. Wong 2021-09-01 645 case XFS_DINODE_FMT_EXTENTS:
ebbf385a912f3d Darrick J. Wong 2021-09-01 @646 flags |= extflag[whichfork];
ebbf385a912f3d Darrick J. Wong 2021-09-01 647 break;
ebbf385a912f3d Darrick J. Wong 2021-09-01 648 case XFS_DINODE_FMT_BTREE:
ebbf385a912f3d Darrick J. Wong 2021-09-01 649 flags |= brootflag[whichfork];
ebbf385a912f3d Darrick J. Wong 2021-09-01 650 break;
ebbf385a912f3d Darrick J. Wong 2021-09-01 651 default:
ebbf385a912f3d Darrick J. Wong 2021-09-01 652 ASSERT(0);
ebbf385a912f3d Darrick J. Wong 2021-09-01 653 break;
ebbf385a912f3d Darrick J. Wong 2021-09-01 654 }
ebbf385a912f3d Darrick J. Wong 2021-09-01 655 xfs_trans_log_inode(tp, cur->bc_ino.ip, flags);
ebbf385a912f3d Darrick J. Wong 2021-09-01 656 xfs_btree_commit_ifakeroot(cur, tp, whichfork, &xfs_bmbt_ops);
ebbf385a912f3d Darrick J. Wong 2021-09-01 657 }
ebbf385a912f3d Darrick J. Wong 2021-09-01 658
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
[drm-misc:drm-misc-next 1/6] drivers/gpu/drm/ingenic/ingenic-drm-drv.c:1134 ingenic_drm_bind() error: uninitialized symbol 'dma_hwdesc_phys_f0'.
by kernel test robot
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Paul Cercueil <paul(a)crapouillou.net>
CC: Christophe Branchereau <cbranchereau(a)gmail.com>
tree: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head: dded00395bdbd45a16d1504a1da77103522b28af
commit: 1bdb542da736e299a3fb291e5905a14dc955b938 [1/6] drm/ingenic: Simplify code by using hwdescs array
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: mips-randconfig-m031-20211028 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:1134 ingenic_drm_bind() error: uninitialized symbol 'dma_hwdesc_phys_f0'.
drivers/gpu/drm/ingenic/ingenic-drm-drv.c:1135 ingenic_drm_bind() error: uninitialized symbol 'dma_hwdesc_phys_f1'.
vim +/dma_hwdesc_phys_f0 +1134 drivers/gpu/drm/ingenic/ingenic-drm-drv.c
1bdb542da736e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-10-26 879
3b5b005ef7d9e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-08-27 880 static int ingenic_drm_bind(struct device *dev, bool has_components)
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 881 {
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 882 struct platform_device *pdev = to_platform_device(dev);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 883 const struct jz_soc_info *soc_info;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 884 struct ingenic_drm *priv;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 885 struct clk *parent_clk;
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 886 struct drm_plane *primary;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 887 struct drm_bridge *bridge;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 888 struct drm_panel *panel;
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 889 struct drm_encoder *encoder;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 890 struct drm_device *drm;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 891 void __iomem *base;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 892 long parent_rate;
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 893 unsigned int i, clone_mask = 0;
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 894 dma_addr_t dma_hwdesc_phys_f0, dma_hwdesc_phys_f1;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 895 int ret, irq;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 896
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 897 soc_info = of_device_get_match_data(dev);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 898 if (!soc_info) {
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 899 dev_err(dev, "Missing platform data\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 900 return -EINVAL;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 901 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 902
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 903 if (IS_ENABLED(CONFIG_OF_RESERVED_MEM)) {
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 904 ret = of_reserved_mem_device_init(dev);
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 905
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 906 if (ret && ret != -ENODEV)
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 907 dev_warn(dev, "Failed to get reserved memory: %d\n", ret);
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 908
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 909 if (!ret) {
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 910 ret = devm_add_action_or_reset(dev, ingenic_drm_release_rmem, dev);
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 911 if (ret)
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 912 return ret;
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 913 }
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 914 }
1677d31c226683 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 915
37d8d81f019ac1 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-04-15 916 priv = devm_drm_dev_alloc(dev, &ingenic_drm_driver_data,
37d8d81f019ac1 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-04-15 917 struct ingenic_drm, drm);
37d8d81f019ac1 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-04-15 918 if (IS_ERR(priv))
37d8d81f019ac1 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-04-15 919 return PTR_ERR(priv);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 920
a7c909b7c037fa drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-12-10 921 priv->soc_info = soc_info;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 922 priv->dev = dev;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 923 drm = &priv->drm;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 924
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 925 platform_set_drvdata(pdev, priv);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 926
fe1cc102a381a9 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-03-23 927 ret = drmm_mode_config_init(drm);
fe1cc102a381a9 drivers/gpu/drm/ingenic/ingenic-drm.c Daniel Vetter 2020-03-23 928 if (ret)
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 929 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 930
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 931 drm->mode_config.min_width = 0;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 932 drm->mode_config.min_height = 0;
a7c909b7c037fa drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-12-10 933 drm->mode_config.max_width = soc_info->max_width;
96ea0ae692fe38 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-12-10 934 drm->mode_config.max_height = 4095;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 935 drm->mode_config.funcs = &ingenic_drm_mode_config_funcs;
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 936 drm->mode_config.helper_private = &ingenic_drm_mode_config_helpers;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 937
ffa8aa00e9e589 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-27 938 base = devm_platform_ioremap_resource(pdev, 0);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 939 if (IS_ERR(base)) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 940 dev_err(dev, "Failed to get memory resource\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 941 return PTR_ERR(base);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 942 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 943
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 944 priv->map = devm_regmap_init_mmio(dev, base,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 945 &ingenic_drm_regmap_config);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 946 if (IS_ERR(priv->map)) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 947 dev_err(dev, "Failed to create regmap\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 948 return PTR_ERR(priv->map);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 949 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 950
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 951 irq = platform_get_irq(pdev, 0);
71c45008e2b0d6 drivers/gpu/drm/ingenic/ingenic-drm.c Markus Elfring 2020-04-05 952 if (irq < 0)
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 953 return irq;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 954
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 955 if (soc_info->needs_dev_clk) {
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 956 priv->lcd_clk = devm_clk_get(dev, "lcd");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 957 if (IS_ERR(priv->lcd_clk)) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 958 dev_err(dev, "Failed to get lcd clock\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 959 return PTR_ERR(priv->lcd_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 960 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 961 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 962
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 963 priv->pix_clk = devm_clk_get(dev, "lcd_pclk");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 964 if (IS_ERR(priv->pix_clk)) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 965 dev_err(dev, "Failed to get pixel clock\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 966 return PTR_ERR(priv->pix_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 967 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 968
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 969 priv->dma_hwdescs = dmam_alloc_coherent(dev,
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 970 sizeof(*priv->dma_hwdescs),
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 971 &priv->dma_hwdescs_phys,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 972 GFP_KERNEL);
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 973 if (!priv->dma_hwdescs)
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 974 return -ENOMEM;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 975
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 976 /* Configure DMA hwdesc for foreground0 plane */
1bdb542da736e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-10-26 977 ingenic_drm_configure_hwdesc_plane(priv, 0);
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 978
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 979 /* Configure DMA hwdesc for foreground1 plane */
1bdb542da736e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-10-26 980 ingenic_drm_configure_hwdesc_plane(priv, 1);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 981
686d4b4b99afe7 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-27 982 /* Configure DMA hwdesc for palette */
1bdb542da736e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-10-26 983 ingenic_drm_configure_hwdesc_palette(priv);
686d4b4b99afe7 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-27 984
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 985 primary = priv->soc_info->has_osd ? &priv->f1 : &priv->f0;
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 986
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 987 drm_plane_helper_add(primary, &ingenic_drm_plane_helper_funcs);
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 988
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 989 ret = drm_universal_plane_init(drm, primary, 1,
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 990 &ingenic_drm_primary_plane_funcs,
3d705fb0dc43a9 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 991 priv->soc_info->formats_f1,
3d705fb0dc43a9 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 992 priv->soc_info->num_formats_f1,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 993 NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 994 if (ret) {
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 995 dev_err(dev, "Failed to register plane: %i\n", ret);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 996 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 997 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 998
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 999 if (soc_info->map_noncoherent)
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 1000 drm_plane_enable_fb_damage_clips(&priv->f1);
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 1001
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1002 drm_crtc_helper_add(&priv->crtc, &ingenic_drm_crtc_helper_funcs);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1003
7b4957684e5d81 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-01-24 1004 ret = drm_crtc_init_with_planes(drm, &priv->crtc, primary,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1005 NULL, &ingenic_drm_crtc_funcs, NULL);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1006 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1007 dev_err(dev, "Failed to init CRTC: %i\n", ret);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1008 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1009 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1010
686d4b4b99afe7 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-27 1011 drm_crtc_enable_color_mgmt(&priv->crtc, 0, false,
686d4b4b99afe7 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-27 1012 ARRAY_SIZE(priv->dma_hwdescs->palette));
686d4b4b99afe7 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-27 1013
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1014 if (soc_info->has_osd) {
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1015 drm_plane_helper_add(&priv->f0,
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1016 &ingenic_drm_plane_helper_funcs);
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1017
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1018 ret = drm_universal_plane_init(drm, &priv->f0, 1,
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1019 &ingenic_drm_primary_plane_funcs,
3d705fb0dc43a9 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1020 priv->soc_info->formats_f0,
3d705fb0dc43a9 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1021 priv->soc_info->num_formats_f0,
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1022 NULL, DRM_PLANE_TYPE_OVERLAY,
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1023 NULL);
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1024 if (ret) {
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1025 dev_err(dev, "Failed to register overlay plane: %i\n",
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1026 ret);
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1027 return ret;
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1028 }
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1029
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 1030 if (soc_info->map_noncoherent)
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 1031 drm_plane_enable_fb_damage_clips(&priv->f0);
4a791cb6d34f42 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-05-23 1032
3b5b005ef7d9e2 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-08-27 1033 if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1034 ret = component_bind_all(dev, drm);
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1035 if (ret) {
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1036 if (ret != -EPROBE_DEFER)
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1037 dev_err(dev, "Failed to bind components: %i\n", ret);
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1038 return ret;
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1039 }
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1040
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1041 ret = devm_add_action_or_reset(dev, ingenic_drm_unbind_all, priv);
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1042 if (ret)
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1043 return ret;
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1044
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1045 priv->ipu_plane = drm_plane_from_index(drm, 2);
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1046 if (!priv->ipu_plane) {
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1047 dev_err(dev, "Failed to retrieve IPU plane\n");
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1048 return -EINVAL;
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1049 }
fc1acf317b0108 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1050 }
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1051 }
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1052
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1053 for (i = 0; ; i++) {
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1054 ret = drm_of_find_panel_or_bridge(dev->of_node, 0, i, &panel, &bridge);
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1055 if (ret) {
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1056 if (ret == -ENODEV)
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1057 break; /* we're done */
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1058 if (ret != -EPROBE_DEFER)
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1059 dev_err(dev, "Failed to get bridge handle\n");
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1060 return ret;
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1061 }
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1062
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1063 if (panel)
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1064 bridge = devm_drm_panel_bridge_add_typed(dev, panel,
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1065 DRM_MODE_CONNECTOR_DPI);
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1066
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1067 encoder = drmm_plain_encoder_alloc(drm, NULL, DRM_MODE_ENCODER_DPI, NULL);
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1068 if (IS_ERR(encoder)) {
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1069 ret = PTR_ERR(encoder);
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1070 dev_err(dev, "Failed to init encoder: %d\n", ret);
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1071 return ret;
e488b1023a4a4e drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2021-03-27 1072 }
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1073
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1074 encoder->possible_crtcs = 1;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1075
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1076 drm_encoder_helper_add(encoder, &ingenic_drm_encoder_helper_funcs);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1077
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1078 ret = drm_bridge_attach(encoder, bridge, NULL, 0);
fb8d617f8fd64f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Laurent Pinchart 2021-03-23 1079 if (ret)
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1080 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1081 }
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1082
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1083 drm_for_each_encoder(encoder, drm) {
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1084 clone_mask |= BIT(drm_encoder_index(encoder));
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1085 }
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1086
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1087 drm_for_each_encoder(encoder, drm) {
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1088 encoder->possible_clones = clone_mask;
c369cb27c267fe drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1089 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1090
613ba71619cfe0 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Thomas Zimmermann 2021-07-15 1091 ret = devm_request_irq(dev, irq, ingenic_drm_irq_handler, 0, drm->driver->name, drm);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1092 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1093 dev_err(dev, "Unable to install IRQ handler\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1094 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1095 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1096
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1097 ret = drm_vblank_init(drm, 1);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1098 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1099 dev_err(dev, "Failed calling drm_vblank_init()\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1100 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1101 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1102
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1103 drm_mode_config_reset(drm);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1104
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1105 ret = clk_prepare_enable(priv->pix_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1106 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1107 dev_err(dev, "Unable to start pixel clock\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1108 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1109 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1110
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1111 if (priv->lcd_clk) {
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1112 parent_clk = clk_get_parent(priv->lcd_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1113 parent_rate = clk_get_rate(parent_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1114
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1115 /* LCD Device clock must be 3x the pixel clock for STN panels,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1116 * or 1.5x the pixel clock for TFT panels. To avoid having to
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1117 * check for the LCD device clock everytime we do a mode change,
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1118 * we set the LCD device clock to the highest rate possible.
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1119 */
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1120 ret = clk_set_rate(priv->lcd_clk, parent_rate);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1121 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1122 dev_err(dev, "Unable to set LCD clock rate\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1123 goto err_pixclk_disable;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1124 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1125
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1126 ret = clk_prepare_enable(priv->lcd_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1127 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1128 dev_err(dev, "Unable to start lcd clock\n");
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1129 goto err_pixclk_disable;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1130 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1131 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1132
e5507d2c01362b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1133 /* Set address of our DMA descriptor chain */
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 @1134 regmap_write(priv->map, JZ_REG_LCD_DA0, dma_hwdesc_phys_f0);
174d8e52a60f19 drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 @1135 regmap_write(priv->map, JZ_REG_LCD_DA1, dma_hwdesc_phys_f1);
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1136
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1137 /* Enable OSD if available */
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1138 if (soc_info->has_osd)
3c9bea4ef32bdc drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1139 regmap_write(priv->map, JZ_REG_LCD_OSDC, JZ_LCD_OSDC_OSDEN);
e5507d2c01362b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1140
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1141 mutex_init(&priv->clk_mutex);
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1142 priv->clock_nb.notifier_call = ingenic_drm_update_pixclk;
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1143
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1144 parent_clk = clk_get_parent(priv->pix_clk);
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1145 ret = clk_notifier_register(parent_clk, &priv->clock_nb);
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1146 if (ret) {
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1147 dev_err(dev, "Unable to register clock notifier\n");
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1148 goto err_devclk_disable;
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1149 }
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1150
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1151 ret = drm_dev_register(drm, 0);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1152 if (ret) {
1f7596f4ad9b7f drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-07-16 1153 dev_err(dev, "Failed to register DRM driver\n");
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1154 goto err_clk_notifier_unregister;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1155 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1156
38d356c7fe7fd4 drivers/gpu/drm/ingenic/ingenic-drm.c Thomas Zimmermann 2020-04-08 1157 drm_fbdev_generic_setup(drm, 32);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1158
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1159 return 0;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1160
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1161 err_clk_notifier_unregister:
33700f6f7d9f6b drivers/gpu/drm/ingenic/ingenic-drm-drv.c Paul Cercueil 2020-09-26 1162 clk_notifier_unregister(parent_clk, &priv->clock_nb);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1163 err_devclk_disable:
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1164 if (priv->lcd_clk)
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1165 clk_disable_unprepare(priv->lcd_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1166 err_pixclk_disable:
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1167 clk_disable_unprepare(priv->pix_clk);
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1168 return ret;
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1169 }
90b86fcc47b4d1 drivers/gpu/drm/ingenic/ingenic-drm.c Paul Cercueil 2019-06-03 1170
:::::: The code at line 1134 was first introduced by commit
:::::: 174d8e52a60f196cfbdec299688cf14f124c8b67 drm/ingenic: Alloc F0 and F1 DMA descriptors at once
:::::: TO: Paul Cercueil <paul(a)crapouillou.net>
:::::: CC: Paul Cercueil <paul(a)crapouillou.net>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
Re: [RESEND PATCH v2 7/7] usb: typec: qcom: Add a pm8150b TCPM driver
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211028164941.831918-8-bryan.odonoghue(a)linaro.org>
References: <20211028164941.831918-8-bryan.odonoghue(a)linaro.org>
TO: "Bryan O'Donoghue" <bryan.odonoghue(a)linaro.org>
TO: linux(a)roeck-us.net
TO: heikki.krogerus(a)linux.intel.com
TO: rdunlap(a)infradead.org
TO: gregkh(a)linuxfoundation.org
TO: bjorn.andersson(a)linaro.org
TO: robh+dt(a)kernel.org
TO: linux-usb(a)vger.kernel.org
TO: linux-arm-msm(a)vger.kernel.org
TO: devicetree(a)vger.kernel.org
CC: wcheng(a)codeaurora.org
Hi Bryan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bryan-O-Donoghue/Add-pm8150b-TPC...
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/fe4e9d995058581a4428c9c5c91e848ea...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bryan-O-Donoghue/Add-pm8150b-TPCM-driver/20211029-010406
git checkout fe4e9d995058581a4428c9c5c91e848eab3beef5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
#define WRITE_ONCE(x, val) \
^
drivers/dma-buf/heaps/system_heap.c:359:2: note: Returning from 'INIT_LIST_HEAD'
INIT_LIST_HEAD(&pages);
^~~~~~~~~~~~~~~~~~~~~~
drivers/dma-buf/heaps/system_heap.c:361:9: note: Assuming 'size_remaining' is <= 0
while (size_remaining > 0) {
^~~~~~~~~~~~~~~~~~
drivers/dma-buf/heaps/system_heap.c:361:2: note: Loop condition is false. Execution continues on line 381
while (size_remaining > 0) {
^
drivers/dma-buf/heaps/system_heap.c:382:6: note: Assuming the condition is true
if (sg_alloc_table(table, i, GFP_KERNEL))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/dma-buf/heaps/system_heap.c:382:2: note: Taking true branch
if (sg_alloc_table(table, i, GFP_KERNEL))
^
drivers/dma-buf/heaps/system_heap.c:383:3: note: Control jumps to line 413
goto free_buffer;
^
drivers/dma-buf/heaps/system_heap.c:413:2: note: Left side of '&&' is false
list_for_each_entry_safe(page, tmp_page, &pages, lru)
^
include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
for (pos = list_first_entry(head, typeof(*pos), member), \
^
include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
list_entry((ptr)->next, type, member)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
drivers/dma-buf/heaps/system_heap.c:413:2: note: Taking false branch
list_for_each_entry_safe(page, tmp_page, &pages, lru)
^
include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
for (pos = list_first_entry(head, typeof(*pos), member), \
^
include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
list_entry((ptr)->next, type, member)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
drivers/dma-buf/heaps/system_heap.c:413:2: note: Loop condition is false. Exiting loop
list_for_each_entry_safe(page, tmp_page, &pages, lru)
^
include/linux/list.h:715:13: note: expanded from macro 'list_for_each_entry_safe'
for (pos = list_first_entry(head, typeof(*pos), member), \
^
include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
list_entry((ptr)->next, type, member)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
drivers/dma-buf/heaps/system_heap.c:413:2: note: Assigned value is garbage or undefined
list_for_each_entry_safe(page, tmp_page, &pages, lru)
^
include/linux/list.h:716:7: note: expanded from macro 'list_for_each_entry_safe'
n = list_next_entry(pos, member); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
list_entry((pos)->member.next, typeof(*(pos)), member)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:494:2: note: expanded from macro 'container_of'
void *__mptr = (void *)(ptr); \
^ ~~~~~~~~~~~~~
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
12 warnings generated.
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:153:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:153:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:214:2: warning: Value stored to 'debounced' is never read [clang-analyzer-deadcode.DeadStores]
debounced = !!(misc & TYPEC_DEBOUNCE_DONE);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:214:2: note: Value stored to 'debounced' is never read
debounced = !!(misc & TYPEC_DEBOUNCE_DONE);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:308:2: warning: Value stored to 'orientation' is never read [clang-analyzer-deadcode.DeadStores]
orientation = !!(misc & CC_ORIENTATION);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:308:2: note: Value stored to 'orientation' is never read
orientation = !!(misc & CC_ORIENTATION);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:361:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:361:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:399:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c:399:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = pmic_typec->dev;
^~~ ~~~~~~~~~~~~~~~
Suppressed 7 warnings (5 in non-user code, 2 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
12 warnings generated.
>> drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:134:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = pmic_pdphy->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:134:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = pmic_pdphy->dev;
^~~ ~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:243:3: warning: 4th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
dev_err(dev, "pd_transmit_payload: %d hdr %*ph data %*ph ret %d\n",
^
include/linux/dev_printk.h:144:24: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:258:6: note: Assuming 'msg' is non-null
if (msg) {
^~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:258:2: note: Taking true branch
if (msg) {
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:259:9: note: Calling 'qcom_pmic_tcpm_pdphy_pd_transmit_payload'
ret = qcom_pmic_tcpm_pdphy_pd_transmit_payload(pmic_pdphy, type,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:174:20: note: 'hdr_len' declared without an initial value
unsigned int val, hdr_len, txbuf_len, txsize_len;
^~~~~~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:178:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&pmic_pdphy->lock, flags);
^
include/linux/spinlock.h:393:2: note: expanded from macro 'spin_lock_irqsave'
raw_spin_lock_irqsave(spinlock_check(lock), flags); \
^
include/linux/spinlock.h:254:2: note: expanded from macro 'raw_spin_lock_irqsave'
do { \
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:178:2: note: Loop condition is false. Exiting loop
spin_lock_irqsave(&pmic_pdphy->lock, flags);
^
include/linux/spinlock.h:391:43: note: expanded from macro 'spin_lock_irqsave'
#define spin_lock_irqsave(lock, flags) \
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:183:6: note: Assuming 'ret' is not equal to 0
if (ret)
^~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:183:2: note: Taking true branch
if (ret)
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:184:3: note: Control jumps to line 240
goto done;
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:242:6: note: 'ret' is not equal to 0
if (ret) {
^~~
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:242:2: note: Taking true branch
if (ret) {
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:243:3: note: Left side of '&&' is true
dev_err(dev, "pd_transmit_payload: %d hdr %*ph data %*ph ret %d\n",
^
include/linux/dev_printk.h:144:2: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:109:3: note: expanded from macro 'dev_printk_index_wrap'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:370:7: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:243:3: note: Taking true branch
dev_err(dev, "pd_transmit_payload: %d hdr %*ph data %*ph ret %d\n",
^
include/linux/dev_printk.h:144:2: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:109:3: note: expanded from macro 'dev_printk_index_wrap'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:370:3: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_pdphy.c:243:3: note: '?' condition is true
dev_err(dev, "pd_transmit_payload: %d hdr %*ph data %*ph ret %d\n",
^
include/linux/dev_printk.h:144:2: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:109:3: note: expanded from macro 'dev_printk_index_wrap'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
vim +/dev +153 drivers/usb/typec/tcpm/qcom/qcom_pmic_tcpm_typec.c
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 150
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 151 int qcom_pmic_tcpm_typec_get_vbus(struct pmic_typec *pmic_typec)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 152 {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 @153 struct device *dev = pmic_typec->dev;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 154 unsigned int misc;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 155 int ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 156
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 157 ret = regmap_read(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 158 pmic_typec->base + TYPEC_MISC_STATUS_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 159 &misc);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 160 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 161 misc = 0;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 162
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 163 dev_dbg(dev, "get_vbus: 0x%08x detect %d\n", misc, !!(misc & TYPEC_VBUS_DETECT));
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 164
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 165 return !!(misc & TYPEC_VBUS_DETECT);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 166 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 167
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 168 int qcom_pmic_tcpm_typec_set_vbus(struct pmic_typec *pmic_typec, bool on)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 169 {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 170 u32 sm_stat;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 171 u32 val;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 172 int ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 173
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 174 if (on) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 175 ret = regulator_enable(pmic_typec->vdd_vbus);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 176 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 177 return ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 178
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 179 val = TYPEC_SM_VBUS_VSAFE5V;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 180 } else {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 181 ret = regulator_disable(pmic_typec->vdd_vbus);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 182 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 183 return ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 184
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 185 val = TYPEC_SM_VBUS_VSAFE0V;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 186 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 187
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 188 /* Poll waiting for transition to required vSafe5V or vSafe0V */
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 189 ret = regmap_read_poll_timeout(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 190 pmic_typec->base + TYPEC_SM_STATUS_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 191 sm_stat, sm_stat & val,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 192 100, 250000);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 193 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 194 dev_err(pmic_typec->dev, "vbus vsafe%dv fail\n", on ? 5 : 0);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 195
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 196 return ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 197 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 198
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 199 int qcom_pmic_tcpm_typec_get_cc(struct pmic_typec *pmic_typec,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 200 enum typec_cc_status *cc1,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 201 enum typec_cc_status *cc2)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 202 {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 203 struct device *dev = pmic_typec->dev;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 204 unsigned int misc, val;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 205 bool attached, debounced;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 206 int ret = 0;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 207
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 208 ret = regmap_read(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 209 pmic_typec->base + TYPEC_MISC_STATUS_REG, &misc);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 210 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 211 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 212
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 213 attached = !!(misc & CC_ATTACHED);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 @214 debounced = !!(misc & TYPEC_DEBOUNCE_DONE);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 215
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 216 if (pmic_typec->debouncing_cc) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 217 ret = -EBUSY;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 218 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 219 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 220
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 221 *cc1 = TYPEC_CC_OPEN;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 222 *cc2 = TYPEC_CC_OPEN;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 223
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 224 if (!(attached))
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 225 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 226
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 227 if (misc & SNK_SRC_MODE) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 228 ret = regmap_read(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 229 pmic_typec->base + TYPEC_SRC_STATUS_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 230 &val);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 231 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 232 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 233 switch (val & DETECTED_SRC_TYPE_MASK) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 234 case SRC_RD_OPEN:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 235 val = TYPEC_CC_RD;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 236 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 237 case SRC_RD_RA_VCONN:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 238 val = TYPEC_CC_RD;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 239 *cc1 = TYPEC_CC_RA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 240 *cc2 = TYPEC_CC_RA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 241 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 242 default:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 243 dev_warn(dev, "unexpected src status %.2x\n", val);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 244 val = TYPEC_CC_RD;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 245 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 246 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 247 } else {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 248 ret = regmap_read(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 249 pmic_typec->base + TYPEC_SNK_STATUS_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 250 &val);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 251 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 252 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 253 switch (val & DETECTED_SNK_TYPE_MASK) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 254 case SNK_RP_STD:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 255 val = TYPEC_CC_RP_DEF;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 256 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 257 case SNK_RP_1P5:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 258 val = TYPEC_CC_RP_1_5;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 259 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 260 case SNK_RP_3P0:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 261 val = TYPEC_CC_RP_3_0;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 262 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 263 default:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 264 dev_warn(dev, "unexpected snk status %.2x\n", val);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 265 val = TYPEC_CC_RP_DEF;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 266 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 267 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 268 val = TYPEC_CC_RP_DEF;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 269 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 270
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 271 if (misc & CC_ORIENTATION)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 272 *cc2 = val;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 273 else
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 274 *cc1 = val;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 275
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 276 done:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 277 dev_dbg(dev, "get_cc: misc 0x%08x cc1 0x%08x %s cc2 0x%08x %s attached %d cc=%s\n",
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 278 misc, *cc1, cc_to_name(*cc1), *cc2, cc_to_name(*cc2), !!(misc & CC_ATTACHED),
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 279 misc_to_cc(misc));
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 280
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 281 return ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 282 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 283
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 284 static void qcom_pmic_set_cc_debounce(struct pmic_typec *pmic_typec)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 285 {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 286 pmic_typec->debouncing_cc = true;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 287 schedule_delayed_work(&pmic_typec->cc_debounce_dwork,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 288 msecs_to_jiffies(2));
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 289 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 290
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 291 int qcom_pmic_tcpm_typec_set_cc(struct pmic_typec *pmic_typec,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 292 enum typec_cc_status cc)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 293 {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 294 struct device *dev = pmic_typec->dev;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 295 unsigned int mode, currsrc;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 296 unsigned int orientation, misc;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 297 unsigned long flags;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 298 int ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 299
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 300 spin_lock_irqsave(&pmic_typec->lock, flags);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 301
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 302 ret = regmap_read(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 303 pmic_typec->base + TYPEC_MISC_STATUS_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 304 &misc);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 305 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 306 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 307
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 @308 orientation = !!(misc & CC_ORIENTATION);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 309
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 310 mode = EN_SRC_ONLY;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 311
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 312 switch (cc) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 313 case TYPEC_CC_OPEN:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 314 currsrc = TYPEC_SRC_RP_SEL_80UA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 315 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 316 case TYPEC_CC_RP_DEF:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 317 currsrc = TYPEC_SRC_RP_SEL_80UA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 318 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 319 case TYPEC_CC_RP_1_5:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 320 currsrc = TYPEC_SRC_RP_SEL_180UA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 321 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 322 case TYPEC_CC_RP_3_0:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 323 currsrc = TYPEC_SRC_RP_SEL_330UA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 324 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 325 case TYPEC_CC_RD:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 326 currsrc = TYPEC_SRC_RP_SEL_80UA;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 327 mode = EN_SNK_ONLY;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 328 break;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 329 default:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 330 dev_warn(dev, "unexpected set_cc %d\n", cc);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 331 ret = -EINVAL;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 332 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 333 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 334
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 335 if (mode == EN_SRC_ONLY) {
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 336 ret = regmap_write(pmic_typec->regmap,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 337 pmic_typec->base + TYPEC_CURRSRC_CFG_REG,
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 338 currsrc);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 339 if (ret)
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 340 goto done;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 341 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 342
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 343 pmic_typec->cc = cc;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 344 qcom_pmic_set_cc_debounce(pmic_typec);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 345 ret = 0;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 346
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 347 done:
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 348 spin_unlock_irqrestore(&pmic_typec->lock, flags);
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 349
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 350 dev_dbg(dev, "set_cc: currsrc=%x %s mode %s debounce %d attached %d cc=%s\n",
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 351 currsrc, rp_sel_to_name(currsrc),
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 352 mode == EN_SRC_ONLY ? "EN_SRC_ONLY" : "EN_SNK_ONLY",
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 353 pmic_typec->debouncing_cc, !!(misc & CC_ATTACHED),
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 354 misc_to_cc(misc));
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 355
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 356 return ret;
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 357 }
fe4e9d99505858 Bryan O'Donoghue 2021-10-28 358
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
Re: [PATCH 1/3] block: bio-integrity: add PI iovec to bio
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211028112406.101314-2-a.buev(a)yadro.com>
References: <20211028112406.101314-2-a.buev(a)yadro.com>
TO: "Alexander V. Buev" <a.buev(a)yadro.com>
TO: linux-block(a)vger.kernel.org
CC: Jens Axboe <axboe(a)kernel.dk>
CC: Christoph Hellwig <hch(a)lst.de>
CC: "Martin K . Petersen" <martin.petersen(a)oracle.com>
CC: Mikhail Malygin <m.malygin(a)yadro.com>
CC: linux(a)yadro.com
CC: "Alexander V. Buev" <a.buev(a)yadro.com>
Hi "Alexander,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.15-rc7]
[cannot apply to axboe-block/for-next hch-configfs/for-next next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexander-V-Buev/implement-direc...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1fc596a56b334f4d593a2b49e5ff55af6aaa0816
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/582fcf396dced9b11bbf489cd5f64e213...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexander-V-Buev/implement-direct-IO-with-integrity/20211028-193652
git checkout 582fcf396dced9b11bbf489cd5f64e213de2e4fd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
5 warnings generated.
Suppressed 5 warnings (5 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.
6 warnings generated.
drivers/phy/microchip/sparx5_serdes.c:715:10: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
u8 iw = sd25g28_get_iw_setting(macro->priv->dev, mode->bitwidth);
^
drivers/phy/microchip/sparx5_serdes.c:2219:6: note: Assuming 'err' is 0
if (err)
^~~
drivers/phy/microchip/sparx5_serdes.c:2219:2: note: Taking false branch
if (err)
^
drivers/phy/microchip/sparx5_serdes.c:2221:6: note: Assuming field 'serdestype' is equal to SPX5_SDT_25G
if (macro->serdestype == SPX5_SDT_25G)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:2221:2: note: Taking true branch
if (macro->serdestype == SPX5_SDT_25G)
^
drivers/phy/microchip/sparx5_serdes.c:2222:9: note: Calling 'sparx5_sd25g28_config'
err = sparx5_sd25g28_config(macro, true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:1868:8: note: Calling 'sparx5_sd10g25_get_mode_preset'
err = sparx5_sd10g25_get_mode_preset(macro, &mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:647:2: note: Control jumps to 'case SPX5_SD_MODE_SFI:' at line 648
switch (macro->serdesmode) {
^
drivers/phy/microchip/sparx5_serdes.c:649:7: note: Assuming field 'speed' is not equal to SPEED_25000
if (macro->speed == SPEED_25000)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:649:3: note: Taking false branch
if (macro->speed == SPEED_25000)
^
drivers/phy/microchip/sparx5_serdes.c:651:12: note: Assuming field 'speed' is not equal to SPEED_10000
else if (macro->speed == SPEED_10000)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:651:8: note: Taking false branch
else if (macro->speed == SPEED_10000)
^
drivers/phy/microchip/sparx5_serdes.c:653:12: note: Assuming field 'speed' is not equal to SPEED_5000
else if (macro->speed == SPEED_5000)
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:653:8: note: Taking false branch
else if (macro->speed == SPEED_5000)
^
drivers/phy/microchip/sparx5_serdes.c:655:3: note: Execution continues on line 669
break;
^
drivers/phy/microchip/sparx5_serdes.c:669:2: note: Returning without writing to 'mode->bitwidth'
return 0;
^
drivers/phy/microchip/sparx5_serdes.c:1868:8: note: Returning from 'sparx5_sd10g25_get_mode_preset'
err = sparx5_sd10g25_get_mode_preset(macro, &mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:1869:6: note: 'err' is 0
if (err)
^~~
drivers/phy/microchip/sparx5_serdes.c:1869:2: note: Taking false branch
if (err)
^
drivers/phy/microchip/sparx5_serdes.c:1871:2: note: Calling 'sparx5_sd25g28_get_params'
sparx5_sd25g28_get_params(macro, &media, &mode, &args, ¶ms);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/phy/microchip/sparx5_serdes.c:715:10: note: 2nd function call argument is an uninitialized value
u8 iw = sd25g28_get_iw_setting(macro->priv->dev, mode->bitwidth);
^ ~~~~~~~~~~~~~~
Suppressed 5 warnings (5 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.
7 warnings generated.
block/bfq-wf2q.c:263:7: warning: Access to field 'my_sched_data' results in a dereference of a null pointer (loaded from variable 'entity') [clang-analyzer-core.NullDereference]
if (!entity->my_sched_data)
^
block/bfq-wf2q.c:1508:2: note: 'entity' initialized to a null pointer value
struct bfq_entity *entity = NULL;
^~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-wf2q.c:1512:6: note: Assuming the condition is false
if (bfq_tot_busy_queues(bfqd) == 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-wf2q.c:1512:2: note: Taking false branch
if (bfq_tot_busy_queues(bfqd) == 0)
^
block/bfq-wf2q.c:1521:2: note: Loop condition is false. Execution continues on line 1582
for (; sd ; sd = entity->my_sched_data) {
^
block/bfq-wf2q.c:1582:28: note: Passing null pointer value via 1st parameter 'entity'
bfqq = bfq_entity_to_bfqq(entity);
^~~~~~
block/bfq-wf2q.c:1582:9: note: Calling 'bfq_entity_to_bfqq'
bfqq = bfq_entity_to_bfqq(entity);
^~~~~~~~~~~~~~~~~~~~~~~~~~
block/bfq-wf2q.c:263:7: note: Access to field 'my_sched_data' results in a dereference of a null pointer (loaded from variable 'entity')
if (!entity->my_sched_data)
^~~~~~
Suppressed 6 warnings (6 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.
7 warnings generated.
Suppressed 7 warnings (6 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
6 warnings generated.
>> block/bio-integrity.c:492:13: warning: Access to field 'bip_flags' results in a dereference of an undefined pointer value (loaded from variable 'bip') [clang-analyzer-core.NullDereference]
if (ret && bip->bip_flags & BIP_RELEASE_PAGES)
^~~
block/bio-integrity.c:406:2: note: 'bip' declared without an initial value
struct bio_integrity_payload *bip;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
block/bio-integrity.c:417:16: note: 'bi' is non-null
if (unlikely(!bi)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
block/bio-integrity.c:417:2: note: Taking false branch
if (unlikely(!bi)) {
^
block/bio-integrity.c:425:15: note: Assuming 'nr_vec_page' is <= 8
if (unlikely(nr_vec_page > __MAX_ONSTACK_PI_PAGES)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
block/bio-integrity.c:425:2: note: Taking false branch
if (unlikely(nr_vec_page > __MAX_ONSTACK_PI_PAGES)) {
^
block/bio-integrity.c:432:15: note: Assuming the condition is true
if (unlikely(intervals * bi->tuple_size < pi_iov->iov_len)) {
^
include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
block/bio-integrity.c:432:2: note: Taking true branch
if (unlikely(intervals * bi->tuple_size < pi_iov->iov_len)) {
^
block/bio-integrity.c:433:3: note: Left side of '&&' is true
pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
^
include/linux/printk.h:489:2: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:446:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
__printk_index_emit(_fmt, NULL, NULL); \
^
include/linux/printk.h:370:7: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
block/bio-integrity.c:433:3: note: Taking true branch
pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
^
include/linux/printk.h:489:2: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:446:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
__printk_index_emit(_fmt, NULL, NULL); \
^
include/linux/printk.h:370:3: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
block/bio-integrity.c:433:3: note: '?' condition is true
pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
^
include/linux/printk.h:489:2: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:446:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
__printk_index_emit(_fmt, NULL, NULL); \
^
include/linux/printk.h:379:12: note: expanded from macro '__printk_index_emit'
.fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
^
block/bio-integrity.c:433:3: note: '?' condition is true
pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
^
include/linux/printk.h:489:2: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:446:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
^
include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
__printk_index_emit(_fmt, NULL, NULL); \
^
include/linux/printk.h:383:14: note: expanded from macro '__printk_index_emit'
.level = __builtin_constant_p(_level) ? (_level) : NULL, \
^
block/bio-integrity.c:433:3: note: Loop condition is false. Exiting loop
pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
^
include/linux/printk.h:489:2: note: expanded from macro 'pr_err'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^
include/linux/printk.h:446:26: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
vim +492 block/bio-integrity.c
7ba1ba12eeef0a fs/bio-integrity.c Martin K. Petersen 2008-06-30 394
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 395 #define __MAX_ONSTACK_PI_PAGES (8)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 396 /**
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 397 * bio_integrity_add_pi_iovec - Add PI io vector
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 398 * @bio: bio whose integrity vector to update
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 399 * @pi_iov: iovec added to @bio's integrity
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 400 *
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 401 * Description: Pins pages for *pi_iov and appends them to @bio's integrity.
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 402 */
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 403 int bio_integrity_add_pi_iovec(struct bio *bio, struct iovec *pi_iov)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 404 {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 405 struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 406 struct bio_integrity_payload *bip;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 407 struct page *pi_pages[__MAX_ONSTACK_PI_PAGES];
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 408 struct page **pi_page = pi_pages;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 409 struct iov_iter pi_iter;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 410 int nr_vec_page = 0;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 411 int ret = 0, intervals = 0;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 412 bool is_write = op_is_write(bio_op(bio));
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 413 ssize_t size, pg_num;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 414 size_t offset;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 415 size_t len;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 416
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 417 if (unlikely(!bi)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 418 pr_err("The disk is not integrity capable");
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 419 return -EINVAL;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 420 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 421
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 422 nr_vec_page = (pi_iov->iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 423 nr_vec_page += 1; // we need this die to data of size N pages can be pinned to N+1 page
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 424
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 425 if (unlikely(nr_vec_page > __MAX_ONSTACK_PI_PAGES)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 426 pi_page = kcalloc(nr_vec_page, sizeof(struct pi_page *), GFP_NOIO);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 427 if (!pi_page)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 428 return -ENOMEM;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 429 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 430
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 431 intervals = bio_integrity_intervals(bi, bio_sectors(bio));
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 432 if (unlikely(intervals * bi->tuple_size < pi_iov->iov_len)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 433 pr_err("Interval number is wrong, intervals=%d, bi->tuple_size=%d, pi_iov->iov_len=%u",
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 434 (int)intervals, (int)bi->tuple_size,
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 435 (unsigned int)pi_iov->iov_len);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 436
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 437 ret = -EINVAL;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 438 goto exit;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 439 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 440
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 441 bip = bio_integrity_alloc(bio, GFP_NOIO, nr_vec_page);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 442 if (IS_ERR(bip)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 443 ret = PTR_ERR(bip);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 444 goto exit;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 445 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 446
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 447 bip->bip_iter.bi_size = pi_iov->iov_len;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 448 bip->bio_iter = bio->bi_iter;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 449 bip_set_seed(bip, bio->bi_iter.bi_sector);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 450
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 451 if (bi->flags & BLK_INTEGRITY_IP_CHECKSUM)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 452 bip->bip_flags |= BIP_IP_CHECKSUM;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 453
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 454 iov_iter_init(&pi_iter, is_write ? WRITE : READ, pi_iov, 1, pi_iov->iov_len);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 455
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 456 // pin user data to pages
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 457 size = iov_iter_get_pages(&pi_iter, pi_page, LONG_MAX, nr_vec_page, &offset);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 458 if (unlikely(size < 0)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 459 pr_err("Failed to pin PI buffer to page");
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 460 ret = -EFAULT;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 461 goto exit;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 462 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 463
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 464 // calc count of pined pages
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 465 if (size > (PAGE_SIZE-offset)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 466 size = DIV_ROUND_UP(size - (PAGE_SIZE-offset), PAGE_SIZE)+1;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 467 } else
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 468 size = 1;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 469
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 470 // fill bio integrity biovecs the given pages
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 471 len = pi_iov->iov_len;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 472 for (pg_num = 0; pg_num < size; ++pg_num) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 473 size_t sz;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 474
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 475 offset = (pg_num)?0:offset;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 476 sz = PAGE_SIZE-offset;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 477 if (sz > len)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 478 sz = len;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 479 ret = bio_integrity_add_page(bio, pi_page[pg_num], sz, offset);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 480 if (unlikely(ret != sz)) {
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 481 ret = -ENOMEM;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 482 goto exit;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 483 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 484 len -= sz;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 485 bip->bip_flags |= BIP_RELEASE_PAGES;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 486 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 487
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 488 ret = 0;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 489
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 490 exit:
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 491
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 @492 if (ret && bip->bip_flags & BIP_RELEASE_PAGES)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 493 bio_integrity_payload_release_pages(bip);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 494
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 495 if (pi_page != pi_pages)
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 496 kfree(pi_page);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 497
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 498 return ret;
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 499 }
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 500 EXPORT_SYMBOL(bio_integrity_add_pi_iovec);
582fcf396dced9 block/bio-integrity.c Alexander V. Buev 2021-10-28 501
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
Re: [PATCH 05/11] ubifs: Rename whiteout atomically
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211025034116.3544321-6-chengzhihao1(a)huawei.com>
References: <20211025034116.3544321-6-chengzhihao1(a)huawei.com>
TO: Zhihao Cheng <chengzhihao1(a)huawei.com>
TO: richard(a)nod.at
TO: miquel.raynal(a)bootlin.com
TO: vigneshr(a)ti.com
TO: mcoquelin.stm32(a)gmail.com
TO: alexandre.torgue(a)foss.st.com
TO: Artem.Bityutskiy(a)nokia.com
TO: ext-adrian.hunter(a)nokia.com
CC: linux-mtd(a)lists.infradead.org
CC: linux-kernel(a)vger.kernel.org
CC: chengzhihao1(a)huawei.com
Hi Zhihao,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master rw-ubifs/next v5.15-rc7 next-20211029]
[cannot apply to rw-ubifs/fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Zhihao-Cheng/Some-bugfixs-for-ub...
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f111a6fd5b5297b4e92f53798ca086f7c7d33a4
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: i386-randconfig-c001-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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
# https://github.com/0day-ci/linux/commit/8a6ca5bc1be93cca9c7b0167a71bdd338...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Zhihao-Cheng/Some-bugfixs-for-ubifs-ubi/20211025-113114
git checkout 8a6ca5bc1be93cca9c7b0167a71bdd338f854600
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
include/linux/printk.h:131:2: note: expanded from macro 'no_printk'
if (0) \
^
fs/ubifs/dir.c:205:8: note: Calling 'fscrypt_prepare_lookup'
err = fscrypt_prepare_lookup(dir, dentry, &nm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fscrypt.h:882:6: note: Assuming the condition is false
if (IS_ENCRYPTED(dir))
^
include/linux/fs.h:2292:30: note: expanded from macro 'IS_ENCRYPTED'
#define IS_ENCRYPTED(inode) ((inode)->i_flags & S_ENCRYPTED)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/fscrypt.h:882:2: note: Taking false branch
if (IS_ENCRYPTED(dir))
^
include/linux/fscrypt.h:887:2: note: Value assigned to 'nm.disk_name.name'
fname->disk_name.name = (unsigned char *)dentry->d_name.name;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:205:8: note: Returning from 'fscrypt_prepare_lookup'
err = fscrypt_prepare_lookup(dir, dentry, &nm);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:207:2: note: Taking false branch
if (err == -ENOENT)
^
fs/ubifs/dir.c:209:6: note: 'err' is 0
if (err)
^~~
fs/ubifs/dir.c:209:2: note: Taking false branch
if (err)
^
fs/ubifs/dir.c:212:6: note: Assuming field 'len' is <= UBIFS_MAX_NLEN
if (fname_len(&nm) > UBIFS_MAX_NLEN) {
^
include/linux/fscrypt.h:44:23: note: expanded from macro 'fname_len'
#define fname_len(p) ((p)->disk_name.len)
^
fs/ubifs/dir.c:212:2: note: Taking false branch
if (fname_len(&nm) > UBIFS_MAX_NLEN) {
^
fs/ubifs/dir.c:218:6: note: Assuming 'dent' is non-null
if (!dent) {
^~~~~
fs/ubifs/dir.c:218:2: note: Taking false branch
if (!dent) {
^
fs/ubifs/dir.c:223:6: note: Assuming field 'name' is equal to NULL
if (fname_name(&nm) == NULL) {
^
include/linux/fscrypt.h:43:24: note: expanded from macro 'fname_name'
#define fname_name(p) ((p)->disk_name.name)
^
fs/ubifs/dir.c:223:2: note: Taking true branch
if (fname_name(&nm) == NULL) {
^
fs/ubifs/dir.c:224:3: note: Taking false branch
if (nm.hash & ~UBIFS_S_KEY_HASH_MASK)
^
fs/ubifs/dir.c:233:6: note: Assuming 'err' is 0
if (err) {
^~~
fs/ubifs/dir.c:233:2: note: Taking false branch
if (err) {
^
fs/ubifs/dir.c:241:6: note: Calling 'dbg_check_name'
if (dbg_check_name(c, dent, &nm)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:184:7: note: Calling 'dbg_is_chk_gen'
if (!dbg_is_chk_gen(c))
^~~~~~~~~~~~~~~~~
fs/ubifs/debug.h:206:12: note: Assuming field 'chk_gen' is not equal to 0
return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen);
^~~~~~~~~~~~~~~~~
fs/ubifs/debug.h:206:30: note: Left side of '||' is true
return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen);
^
fs/ubifs/debug.h:206:2: note: Returning the value 1, which participates in a condition later
return !!(ubifs_dbg.chk_gen || c->dbg->chk_gen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:184:7: note: Returning from 'dbg_is_chk_gen'
if (!dbg_is_chk_gen(c))
^~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:184:2: note: Taking false branch
if (!dbg_is_chk_gen(c))
^
fs/ubifs/dir.c:186:6: note: Assuming field 'nlen' is equal to field 'len'
if (le16_to_cpu(dent->nlen) != fname_len(nm))
^
include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
#define le16_to_cpu __le16_to_cpu
^
include/uapi/linux/byteorder/little_endian.h:36:26: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
fs/ubifs/dir.c:186:2: note: Taking false branch
if (le16_to_cpu(dent->nlen) != fname_len(nm))
^
fs/ubifs/dir.c:188:6: note: Null pointer passed as 2nd argument to memory comparison function
if (memcmp(dent->name, fname_name(nm), fname_len(nm)))
^
>> fs/ubifs/dir.c:379:2: warning: Value stored to 'ui' is never read [clang-analyzer-deadcode.DeadStores]
ui = ubifs_inode(inode);
^ ~~~~~~~~~~~~~~~~~~
fs/ubifs/dir.c:379:2: note: Value stored to 'ui' is never read
ui = ubifs_inode(inode);
^ ~~~~~~~~~~~~~~~~~~
Suppressed 9 warnings (8 in non-user code, 1 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
8 warnings generated.
Suppressed 8 warnings (8 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.
9 warnings generated.
fs/fs-writeback.c:148:3: warning: Argument to kfree() is the address of the local variable 'work', which is not memory allocated by malloc() [clang-analyzer-unix.Malloc]
kfree(work);
^
fs/fs-writeback.c:2691:6: note: Assuming the condition is false
if (bdi == &noop_backing_dev_info)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fs-writeback.c:2691:2: note: Taking false branch
if (bdi == &noop_backing_dev_info)
^
fs/fs-writeback.c:2693:2: note: Taking false branch
WARN_ON(!rwsem_is_locked(&sb->s_umount));
^
include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON'
if (unlikely(__ret_warn_on)) \
^
fs/fs-writeback.c:2697:2: note: Calling 'bdi_split_work_to_wbs'
bdi_split_work_to_wbs(bdi, &work, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fs-writeback.c:1202:2: note: Loop condition is false. Exiting loop
might_sleep();
^
include/linux/kernel.h:132:2: note: expanded from macro 'might_sleep'
do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
^
fs/fs-writeback.c:1204:7: note: 'skip_if_busy' is false
if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) {
^~~~~~~~~~~~
fs/fs-writeback.c:1204:20: note: Left side of '||' is true
if (!skip_if_busy || !writeback_in_progress(&bdi->wb)) {
^
fs/fs-writeback.c:1206:3: note: Calling 'wb_queue_work'
wb_queue_work(&bdi->wb, base_work);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fs-writeback.c:163:6: note: Assuming field 'done' is null
if (work->done)
^~~~~~~~~~
fs/fs-writeback.c:163:2: note: Taking false branch
if (work->done)
^
fs/fs-writeback.c:168:6: note: Assuming the condition is false
if (test_bit(WB_registered, &wb->state)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fs-writeback.c:168:2: note: Taking false branch
if (test_bit(WB_registered, &wb->state)) {
^
fs/fs-writeback.c:172:3: note: Calling 'finish_writeback_work'
finish_writeback_work(wb, work);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/fs-writeback.c:147:6: note: Assuming field 'auto_free' is not equal to 0
if (work->auto_free)
^~~~~~~~~~~~~~~
fs/fs-writeback.c:147:2: note: Taking true branch
if (work->auto_free)
^
fs/fs-writeback.c:148:3: note: Argument to kfree() is the address of the local variable 'work', which is not memory allocated by malloc()
kfree(work);
^ ~~~~
Suppressed 8 warnings (8 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
7 warnings generated.
fs/proc/generic.c:467:4: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy((char*)ent->data,dest);
^~~~~~
fs/proc/generic.c:467:4: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy((char*)ent->data,dest);
^~~~~~
Suppressed 6 warnings (6 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.
8 warnings generated.
Suppressed 8 warnings (8 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
vim +/ui +379 fs/ubifs/dir.c
1e51764a3c2ac0 Artem Bityutskiy 2008-07-14 351
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 352 static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry,
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 353 umode_t mode)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 354 {
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 355 int err;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 356 struct inode *inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 357 struct ubifs_inode *ui;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 358 struct ubifs_info *c = dir->i_sb->s_fs_info;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 359 struct fscrypt_name nm;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 360
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 361 /*
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 362 * Create an inode('nlink = 1') for whiteout without updating journal,
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 363 * let ubifs_jnl_rename() store it on flash to complete rename whiteout
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 364 * atomically.
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 365 */
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 366
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 367 dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 368 dentry, mode, dir->i_ino);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 369
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 370 err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 371 if (err)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 372 return ERR_PTR(err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 373
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 374 inode = ubifs_new_inode(c, dir, mode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 375 if (IS_ERR(inode)) {
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 376 err = PTR_ERR(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 377 goto out_free;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 378 }
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 @379 ui = ubifs_inode(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 380
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 381 init_special_inode(inode, inode->i_mode, WHITEOUT_DEV);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 382 ubifs_assert(c, inode->i_op == &ubifs_file_inode_operations);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 383
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 384 err = ubifs_init_security(dir, inode, &dentry->d_name);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 385 if (err)
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 386 goto out_inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 387
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 388 /* The dir size is updated by do_rename. */
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 389 insert_inode_hash(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 390
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 391 return inode;
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 392
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 393 out_inode:
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 394 make_bad_inode(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 395 iput(inode);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 396 out_free:
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 397 fscrypt_free_filename(&nm);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 398 ubifs_err(c, "cannot create whiteout file, error %d", err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 399 return ERR_PTR(err);
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 400 }
8a6ca5bc1be93c Zhihao Cheng 2021-10-25 401
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
Re: [PATCH RFC] ALSA: control: Use xarray for faster lookups
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211028130027.18764-1-tiwai(a)suse.de>
References: <20211028130027.18764-1-tiwai(a)suse.de>
TO: Takashi Iwai <tiwai(a)suse.de>
Hi Takashi,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Takashi-Iwai/ALSA-control-Use-xa...
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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://github.com/0day-ci/linux/commit/d9e50e9647a202433a7b1c261b0edb002...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Takashi-Iwai/ALSA-control-Use-xarray-for-faster-lookups/20211028-210215
git checkout d9e50e9647a202433a7b1c261b0edb0021f16004
# 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(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
sound/core/control.c:103:11: note: Loop condition is false. Exiting loop
cread = snd_kctl_event(ctl->events.next);
^
include/sound/control.h:95:27: note: expanded from macro 'snd_kctl_event'
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
sound/core/control.c:105:3: note: Memory is released
kfree(cread);
^~~~~~~~~~~~
sound/core/control.c:102:2: note: Loop condition is true. Entering loop body
while (!list_empty(&ctl->events)) {
^
sound/core/control.c:103:11: note: Left side of '&&' is false
cread = snd_kctl_event(ctl->events.next);
^
include/sound/control.h:95:27: note: expanded from macro 'snd_kctl_event'
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
sound/core/control.c:103:11: note: Taking false branch
cread = snd_kctl_event(ctl->events.next);
^
include/sound/control.h:95:27: note: expanded from macro 'snd_kctl_event'
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
sound/core/control.c:103:11: note: Loop condition is false. Exiting loop
cread = snd_kctl_event(ctl->events.next);
^
include/sound/control.h:95:27: note: expanded from macro 'snd_kctl_event'
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
sound/core/control.c:104:3: note: Calling 'list_del'
list_del(&cread->list);
^~~~~~~~~~~~~~~~~~~~~~
include/linux/list.h:147:14: note: Use of memory after it is freed
entry->next = LIST_POISON1;
~~~~~~~~~~~ ^
>> sound/core/control.c:412:3: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
err = xa_insert(&card->ctl_hash, get_ctl_id_hash(&id),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/control.c:412:3: note: Value stored to 'err' is never read
err = xa_insert(&card->ctl_hash, get_ctl_id_hash(&id),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/control.c:1381:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
strcpy(uinfo->value.enumerated.name, names);
^~~~~~
sound/core/control.c:1381:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
strcpy(uinfo->value.enumerated.name, names);
^~~~~~
sound/core/control.c:2273:3: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
__snd_ctl_remove(card, control, false);
^ ~~~~~~~
sound/core/control.c:2271:2: note: Loop condition is true. Entering loop body
while (!list_empty(&card->controls)) {
^
sound/core/control.c:2272:13: note: Left side of '&&' is false
control = snd_kcontrol(card->controls.next);
^
include/sound/control.h:87:25: note: expanded from macro 'snd_kcontrol'
#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
sound/core/control.c:2272:13: note: Taking false branch
control = snd_kcontrol(card->controls.next);
^
include/sound/control.h:87:25: note: expanded from macro 'snd_kcontrol'
#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^
sound/core/control.c:2272:13: note: Loop condition is false. Exiting loop
control = snd_kcontrol(card->controls.next);
^
include/sound/control.h:87:25: note: expanded from macro 'snd_kcontrol'
#define snd_kcontrol(n) list_entry(n, struct snd_kcontrol, list)
^
include/linux/list.h:511:2: note: expanded from macro 'list_entry'
container_of(ptr, type, member)
^
include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
^
include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
^
include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
do { \
^
sound/core/control.c:2273:3: note: Calling '__snd_ctl_remove'
__snd_ctl_remove(card, control, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/core/control.c:562:18: note: 'card' is non-null
if (snd_BUG_ON(!card || !kcontrol))
^
include/sound/core.h:416:25: note: expanded from macro 'snd_BUG_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
sound/core/control.c:562:17: note: Left side of '||' is false
if (snd_BUG_ON(!card || !kcontrol))
^
sound/core/control.c:562:26: note: Assuming 'kcontrol' is non-null
if (snd_BUG_ON(!card || !kcontrol))
^
include/sound/core.h:416:25: note: expanded from macro 'snd_BUG_ON'
int __ret_warn_on = !!(condition); \
^~~~~~~~~
sound/core/control.c:562:2: note: Taking false branch
if (snd_BUG_ON(!card || !kcontrol))
^
sound/core/control.c:566:6: note: 'remove_hash' is false
if (remove_hash)
^~~~~~~~~~~
sound/core/control.c:566:2: note: Taking false branch
if (remove_hash)
^
vim +/err +412 sound/core/control.c
d9e50e9647a202 Takashi Iwai 2021-10-28 398
d9e50e9647a202 Takashi Iwai 2021-10-28 399 /* add hash entries to numid and ctl xarray tables */
d9e50e9647a202 Takashi Iwai 2021-10-28 400 static void add_hash_entries(struct snd_card *card,
d9e50e9647a202 Takashi Iwai 2021-10-28 401 struct snd_kcontrol *kcontrol)
d9e50e9647a202 Takashi Iwai 2021-10-28 402 {
d9e50e9647a202 Takashi Iwai 2021-10-28 403 struct snd_ctl_elem_id id = kcontrol->id;
d9e50e9647a202 Takashi Iwai 2021-10-28 404 int i, err;
d9e50e9647a202 Takashi Iwai 2021-10-28 405
d9e50e9647a202 Takashi Iwai 2021-10-28 406 xa_store_range(&card->ctl_numids, kcontrol->id.numid,
d9e50e9647a202 Takashi Iwai 2021-10-28 407 kcontrol->id.numid + kcontrol->count - 1,
d9e50e9647a202 Takashi Iwai 2021-10-28 408 kcontrol, GFP_KERNEL);
d9e50e9647a202 Takashi Iwai 2021-10-28 409
d9e50e9647a202 Takashi Iwai 2021-10-28 410 for (i = 0; i < kcontrol->count; i++) {
d9e50e9647a202 Takashi Iwai 2021-10-28 411 id.index = kcontrol->id.index + i;
d9e50e9647a202 Takashi Iwai 2021-10-28 @412 err = xa_insert(&card->ctl_hash, get_ctl_id_hash(&id),
d9e50e9647a202 Takashi Iwai 2021-10-28 413 kcontrol, GFP_KERNEL);
d9e50e9647a202 Takashi Iwai 2021-10-28 414 /* ignore errors - it's a best effort */
d9e50e9647a202 Takashi Iwai 2021-10-28 415 }
d9e50e9647a202 Takashi Iwai 2021-10-28 416 }
d9e50e9647a202 Takashi Iwai 2021-10-28 417
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
[linux-next:master 10305/12841] fs/gfs2/file.c:801:3: warning: Value stored to 'pages' is never read [clang-analyzer-deadcode.DeadStores]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm(a)kvack.org>
TO: Andreas Gruenbacher <agruenba(a)redhat.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: bdcc9f6a568275aed4cc32fd2312432d2ff1b704
commit: 00bfe02f479688a67a29019d1228f1470e26f014 [10305/12841] gfs2: Fix mmap + page fault deadlocks for buffered I/O
:::::: branch date: 14 hours ago
:::::: commit date: 5 days ago
config: riscv-randconfig-c006-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 00bfe02f479688a67a29019d1228f1470e26f014
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
4 warnings generated.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
7 warnings generated.
fs/nilfs2/btree.c:1429:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = 0;
^ ~
fs/nilfs2/btree.c:1429:2: note: Value stored to 'ret' is never read
ret = 0;
^ ~
fs/nilfs2/btree.c:2331:7: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
if (!buffer_dirty(bh))
^ ~~
fs/nilfs2/btree.c:2311:2: note: 'bh' declared without an initial value
struct buffer_head *bh;
^~~~~~~~~~~~~~~~~~~~~~
fs/nilfs2/btree.c:2317:6: note: Assuming 'path' is not equal to NULL
if (path == NULL)
^~~~~~~~~~~~
fs/nilfs2/btree.c:2317:2: note: Taking false branch
if (path == NULL)
^
fs/nilfs2/btree.c:2321:6: note: 'ret' is >= 0
if (ret < 0) {
^~~
fs/nilfs2/btree.c:2321:2: note: Taking false branch
if (ret < 0) {
^
fs/nilfs2/btree.c:2325:8: note: Calling 'nilfs_btree_get_block'
ret = nilfs_btree_get_block(btree, ptr, &bh);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nilfs2/btree.c:532:9: note: Calling '__nilfs_btree_get_block'
return __nilfs_btree_get_block(btree, ptr, bhp, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nilfs2/btree.c:480:6: note: Assuming 'ret' is not equal to 0
if (ret) {
^~~
fs/nilfs2/btree.c:480:2: note: Taking true branch
if (ret) {
^
fs/nilfs2/btree.c:481:7: note: Assuming the condition is true
if (ret != -EEXIST)
^~~~~~~~~~~~~~
fs/nilfs2/btree.c:481:3: note: Taking true branch
if (ret != -EEXIST)
^
fs/nilfs2/btree.c:482:4: note: Returning without writing to '*bhp'
return ret;
^
fs/nilfs2/btree.c:532:9: note: Returning from '__nilfs_btree_get_block'
return __nilfs_btree_get_block(btree, ptr, bhp, NULL);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nilfs2/btree.c:532:2: note: Returning without writing to '*bhp'
return __nilfs_btree_get_block(btree, ptr, bhp, NULL);
^
fs/nilfs2/btree.c:2325:8: note: Returning from 'nilfs_btree_get_block'
ret = nilfs_btree_get_block(btree, ptr, &bh);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/nilfs2/btree.c:2326:6: note: Assuming 'ret' is >= 0
if (ret < 0) {
^~~~~~~
fs/nilfs2/btree.c:2326:2: note: Taking false branch
if (ret < 0) {
^
fs/nilfs2/btree.c:2331:7: note: 1st function call argument is an uninitialized value
if (!buffer_dirty(bh))
^ ~~
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
6 warnings generated.
>> fs/gfs2/file.c:801:3: warning: Value stored to 'pages' is never read [clang-analyzer-deadcode.DeadStores]
pages = min(pages, nr_dirtied);
^
fs/gfs2/file.c:801:3: note: Value stored to 'pages' is never read
Suppressed 5 warnings (5 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.
6 warnings generated.
fs/gfs2/ops_fstype.c:852:2: warning: Value stored to 'jindex' is never read [clang-analyzer-deadcode.DeadStores]
jindex = 0;
^ ~
fs/gfs2/ops_fstype.c:852:2: note: Value stored to 'jindex' is never read
jindex = 0;
^ ~
Suppressed 5 warnings (5 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.
7 warnings generated.
fs/gfs2/inode.c:506:3: warning: Null pointer passed as 2nd argument to memory copy function [clang-analyzer-unix.cstring.NullArg]
memcpy(dibh->b_data + sizeof(struct gfs2_dinode), symname, ip->i_inode.i_size);
^
fs/gfs2/inode.c:1253:57: note: Passing null pointer value via 6th parameter 'symname'
return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0);
^
include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
#define NULL ((void *)0)
^~~~~~~~~~~
fs/gfs2/inode.c:1253:9: note: Calling 'gfs2_create_inode'
return gfs2_create_inode(dir, dentry, NULL, mode, dev, NULL, 0, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:618:6: note: Assuming field 'len' is not equal to 0
if (!name->len || name->len > GFS2_FNAMESIZE)
^~~~~~~~~~
fs/gfs2/inode.c:618:6: note: Left side of '||' is false
fs/gfs2/inode.c:618:20: note: Assuming field 'len' is <= GFS2_FNAMESIZE
if (!name->len || name->len > GFS2_FNAMESIZE)
^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:618:2: note: Taking false branch
if (!name->len || name->len > GFS2_FNAMESIZE)
^
fs/gfs2/inode.c:622:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/inode.c:622:2: note: Taking false branch
if (error)
^
fs/gfs2/inode.c:626:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/inode.c:626:2: note: Taking false branch
if (error)
^
fs/gfs2/inode.c:629:10: note: Calling 'gfs2_glock_nq_init'
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/glock.h:247:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/glock.h:247:2: note: Taking false branch
if (error)
^
fs/gfs2/glock.h:250:2: note: Returning zero (loaded from 'error'), which participates in a condition later
return error;
^~~~~~~~~~~~
fs/gfs2/inode.c:629:10: note: Returning from 'gfs2_glock_nq_init'
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:630:6: note: 'error' is 0
if (error)
^~~~~
fs/gfs2/inode.c:630:2: note: Taking false branch
if (error)
^
fs/gfs2/inode.c:634:10: note: Calling 'create_ok'
error = create_ok(dip, name, mode);
^~~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:359:6: note: Assuming 'error' is 0
if (error)
^~~~~
fs/gfs2/inode.c:359:2: note: Taking false branch
if (error)
^
fs/gfs2/inode.c:363:6: note: Assuming field 'i_nlink' is not equal to 0
if (!dip->i_inode.i_nlink)
^~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:363:2: note: Taking false branch
if (!dip->i_inode.i_nlink)
^
fs/gfs2/inode.c:366:6: note: Assuming the condition is false
if (dip->i_entries == (u32)-1)
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:366:2: note: Taking false branch
if (dip->i_entries == (u32)-1)
^
fs/gfs2/inode.c:368:6: note: Assuming the condition is false
if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
^
include/uapi/linux/stat.h:23:21: note: expanded from macro 'S_ISDIR'
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/gfs2/inode.c:368:20: note: Left side of '&&' is false
if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
^
vim +/pages +801 fs/gfs2/file.c
33c3de32872ef3 fs/gfs2/ops_file.c Steven Whitehouse 2006-11-30 778
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 779 static inline bool should_fault_in_pages(ssize_t ret, struct iov_iter *i,
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 780 size_t *prev_count,
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 781 size_t *window_size)
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 782 {
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 783 char __user *p = i->iov[0].iov_base + i->iov_offset;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 784 size_t count = iov_iter_count(i);
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 785 int pages = 1;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 786
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 787 if (likely(!count))
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 788 return false;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 789 if (ret <= 0 && ret != -EFAULT)
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 790 return false;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 791 if (!iter_is_iovec(i))
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 792 return false;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 793
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 794 if (*prev_count != count || !*window_size) {
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 795 int pages, nr_dirtied;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 796
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 797 pages = min_t(int, BIO_MAX_VECS,
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 798 DIV_ROUND_UP(iov_iter_count(i), PAGE_SIZE));
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 799 nr_dirtied = max(current->nr_dirtied_pause -
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 800 current->nr_dirtied, 1);
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 @801 pages = min(pages, nr_dirtied);
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 802 }
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 803
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 804 *prev_count = count;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 805 *window_size = (size_t)PAGE_SIZE * pages - offset_in_page(p);
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 806 return true;
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 807 }
00bfe02f479688 fs/gfs2/file.c Andreas Gruenbacher 2021-10-18 808
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
[avpatel:riscv_kvm_aia_v1 34/45] drivers/irqchip/irq-riscv-imsic.c:298:16: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Anup Patel <anup.patel(a)wdc.com>
tree: https://github.com/avpatel/linux.git riscv_kvm_aia_v1
head: 2c0218849b16b5148a54cec7507d00f41e5cf9b1
commit: 7d466a48354fdd988c5fad3b37eb57fa0846e4d1 [34/45] irqchip: Add incoming MSI controller driver
:::::: branch date: 2 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-c006-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/avpatel/linux/commit/7d466a48354fdd988c5fad3b37eb57fa0...
git remote add avpatel https://github.com/avpatel/linux.git
git fetch --no-tags avpatel riscv_kvm_aia_v1
git checkout 7d466a48354fdd988c5fad3b37eb57fa0846e4d1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
fs/udf/balloc.c:504:11: note: 'elen' declared without an initial value
uint32_t elen, adsize;
^~~~
fs/udf/balloc.c:510:6: note: Assuming 'first_block' is < field 's_partition_len'
if (first_block >= sbi->s_partmaps[partition].s_partition_len)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:510:2: note: Taking false branch
if (first_block >= sbi->s_partmaps[partition].s_partition_len)
^
fs/udf/balloc.c:514:6: note: Assuming field 'i_alloc_type' is equal to ICBTAG_FLAG_AD_SHORT
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:514:2: note: Taking true branch
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
^
fs/udf/balloc.c:527:9: note: Assuming 'first_block' is equal to field 'logicalBlockNum'
while (first_block != eloc.logicalBlockNum &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:527:45: note: Left side of '&&' is false
while (first_block != eloc.logicalBlockNum &&
^
fs/udf/balloc.c:534:6: note: 'first_block' is equal to field 'logicalBlockNum'
if (first_block == eloc.logicalBlockNum) {
^~~~~~~~~~~
fs/udf/balloc.c:534:2: note: Taking true branch
if (first_block == eloc.logicalBlockNum) {
^
fs/udf/balloc.c:537:23: note: The left operand of '>>' is a garbage value
alloc_count = (elen >> sb->s_blocksize_bits);
~~~~ ^
fs/udf/balloc.c:543:13: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
(etype << 30) | elen, 1);
^
fs/udf/balloc.c:680:6: note: Assuming the condition is false
if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:680:2: note: Taking false branch
if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
^
fs/udf/balloc.c:685:11: note: Assuming the condition is true
else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:685:7: note: Taking true branch
else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
^
fs/udf/balloc.c:686:15: note: Calling 'udf_table_prealloc_blocks'
allocated = udf_table_prealloc_blocks(sb,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:510:6: note: Assuming 'first_block' is < field 's_partition_len'
if (first_block >= sbi->s_partmaps[partition].s_partition_len)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:510:2: note: Taking false branch
if (first_block >= sbi->s_partmaps[partition].s_partition_len)
^
fs/udf/balloc.c:514:6: note: Assuming field 'i_alloc_type' is equal to ICBTAG_FLAG_AD_SHORT
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:514:2: note: Taking true branch
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
^
fs/udf/balloc.c:527:9: note: Assuming 'first_block' is not equal to field 'logicalBlockNum'
while (first_block != eloc.logicalBlockNum &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:527:9: note: Left side of '&&' is true
fs/udf/balloc.c:528:10: note: Value assigned to 'etype'
(etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:528:9: note: Assuming the condition is false
(etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:527:2: note: Loop condition is false. Execution continues on line 534
while (first_block != eloc.logicalBlockNum &&
^
fs/udf/balloc.c:534:6: note: Assuming 'first_block' is equal to field 'logicalBlockNum'
if (first_block == eloc.logicalBlockNum) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:534:2: note: Taking true branch
if (first_block == eloc.logicalBlockNum) {
^
fs/udf/balloc.c:538:7: note: Assuming 'alloc_count' is > 'block_count'
if (alloc_count > block_count) {
^~~~~~~~~~~~~~~~~~~~~~~~~
fs/udf/balloc.c:538:3: note: Taking true branch
if (alloc_count > block_count) {
^
fs/udf/balloc.c:543:13: note: The result of the left shift is undefined because the left operand is negative
(etype << 30) | elen, 1);
~~~~~ ^
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
6 warnings generated.
>> drivers/irqchip/irq-riscv-imsic.c:298:16: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult]
(max_id < BIT(order)))
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
drivers/irqchip/irq-riscv-imsic.c:590:8: note: Calling 'imsic_get_cpu'
err = imsic_get_cpu(priv, &priv->lmask, false, &cpu);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:175:6: note: 'force' is false
if (force)
^~~~~
drivers/irqchip/irq-riscv-imsic.c:175:2: note: Taking false branch
if (force)
^
drivers/irqchip/irq-riscv-imsic.c:180:6: note: 'cpu' is < nr_cpu_ids
if (cpu >= nr_cpu_ids)
^~~
drivers/irqchip/irq-riscv-imsic.c:180:2: note: Taking false branch
if (cpu >= nr_cpu_ids)
^
drivers/irqchip/irq-riscv-imsic.c:183:6: note: 'out_target_cpu' is non-null
if (out_target_cpu)
^~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:183:2: note: Taking true branch
if (out_target_cpu)
^
drivers/irqchip/irq-riscv-imsic.c:186:2: note: Returning zero, which participates in a condition later
return 0;
^~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:590:8: note: Returning from 'imsic_get_cpu'
err = imsic_get_cpu(priv, &priv->lmask, false, &cpu);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:591:6: note: 'err' is 0
if (err)
^~~
drivers/irqchip/irq-riscv-imsic.c:591:2: note: Taking false branch
if (err)
^
drivers/irqchip/irq-riscv-imsic.c:594:8: note: Calling 'imsic_cpu_page_phys'
err = imsic_cpu_page_phys(cpu, 0, &msi_addr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:138:12: note: Loop condition is false. Exiting loop
handler = per_cpu_ptr(&imsic_handlers, cpu);
^
include/linux/percpu-defs.h:263:47: note: expanded from macro 'per_cpu_ptr'
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^
include/linux/percpu-defs.h:259:2: note: expanded from macro 'VERIFY_PERCPU_PTR'
__verify_pcpu_ptr(__p); \
^
include/linux/percpu-defs.h:217:37: note: expanded from macro '__verify_pcpu_ptr'
#define __verify_pcpu_ptr(ptr) \
^
drivers/irqchip/irq-riscv-imsic.c:139:7: note: 'handler' is non-null
if (!handler || !handler->priv)
^~~~~~~
drivers/irqchip/irq-riscv-imsic.c:139:6: note: Left side of '||' is false
if (!handler || !handler->priv)
^
drivers/irqchip/irq-riscv-imsic.c:139:18: note: Assuming field 'priv' is non-null
if (!handler || !handler->priv)
^~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:139:2: note: Taking false branch
if (!handler || !handler->priv)
^
drivers/irqchip/irq-riscv-imsic.c:141:6: note: Assuming the condition is false
if (BIT(handler->priv->guest_index_bits) <= guest_index)
^
include/vdso/bits.h:7:19: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
drivers/irqchip/irq-riscv-imsic.c:141:2: note: Taking false branch
if (BIT(handler->priv->guest_index_bits) <= guest_index)
^
drivers/irqchip/irq-riscv-imsic.c:144:6: note: 'out_msi_pa' is non-null
if (out_msi_pa)
^~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:144:2: note: Taking true branch
if (out_msi_pa)
^
drivers/irqchip/irq-riscv-imsic.c:148:2: note: Returning zero, which participates in a condition later
return 0;
^~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:594:8: note: Returning from 'imsic_cpu_page_phys'
err = imsic_cpu_page_phys(cpu, 0, &msi_addr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-riscv-imsic.c:595:6: note: 'err' is 0
if (err)
^~~
drivers/irqchip/irq-riscv-imsic.c:595:2: note: Taking false branch
if (err)
^
drivers/irqchip/irq-riscv-imsic.c:598:46: note: Calling 'get_count_order'
hwirq = imsic_ids_alloc(priv, priv->nr_ids, get_count_order(nr_irqs));
^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/bitops.h:195:6: note: Assuming 'count' is not equal to 0
if (count == 0)
^~~~~~~~~~
include/linux/bitops.h:195:2: note: Taking false branch
if (count == 0)
vim +298 drivers/irqchip/irq-riscv-imsic.c
7d466a48354fdd Anup Patel 2021-04-26 291
7d466a48354fdd Anup Patel 2021-04-26 292 static int imsic_ids_alloc(struct imsic_priv *priv,
7d466a48354fdd Anup Patel 2021-04-26 293 unsigned int max_id, unsigned int order)
7d466a48354fdd Anup Patel 2021-04-26 294 {
7d466a48354fdd Anup Patel 2021-04-26 295 int ret;
7d466a48354fdd Anup Patel 2021-04-26 296
7d466a48354fdd Anup Patel 2021-04-26 297 if ((priv->nr_ids < max_id) ||
7d466a48354fdd Anup Patel 2021-04-26 @298 (max_id < BIT(order)))
7d466a48354fdd Anup Patel 2021-04-26 299 return -EINVAL;
7d466a48354fdd Anup Patel 2021-04-26 300
7d466a48354fdd Anup Patel 2021-04-26 301 raw_spin_lock(&priv->ids_lock);
7d466a48354fdd Anup Patel 2021-04-26 302 ret = bitmap_find_free_region(priv->ids_used_bimap,
7d466a48354fdd Anup Patel 2021-04-26 303 max_id + 1, order);
7d466a48354fdd Anup Patel 2021-04-26 304 raw_spin_unlock(&priv->ids_lock);
7d466a48354fdd Anup Patel 2021-04-26 305
7d466a48354fdd Anup Patel 2021-04-26 306 return ret;
7d466a48354fdd Anup Patel 2021-04-26 307 }
7d466a48354fdd Anup Patel 2021-04-26 308
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks
Re: [PATCH v4] i2c: qcom-geni: Add support for GPI DMA
by kernel test robot
CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211019060158.1482722-1-vkoul(a)kernel.org>
References: <20211019060158.1482722-1-vkoul(a)kernel.org>
TO: Vinod Koul <vkoul(a)kernel.org>
TO: Bjorn Andersson <bjorn.andersson(a)linaro.org>
TO: Wolfram Sang <wsa-dev(a)sang-engineering.com>
CC: linux-arm-msm(a)vger.kernel.org
CC: Vinod Koul <vkoul(a)kernel.org>
CC: Andy Gross <agross(a)kernel.org>
CC: Sumit Semwal <sumit.semwal(a)linaro.org>
CC: Douglas Anderson <dianders(a)chromium.org>
CC: Matthias Kaehlcke <mka(a)chromium.org>
CC: linux-i2c(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
Hi Vinod,
I love your patch! Perhaps something to improve:
[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on v5.15-rc7 next-20211029]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Vinod-Koul/i2c-qcom-geni-Add-sup...
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
:::::: branch date: 10 days ago
:::::: commit date: 10 days ago
config: riscv-randconfig-c006-20211028 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/8244d69587ec2d94d34a75f5a3865d250...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinod-Koul/i2c-qcom-geni-Add-support-for-GPI-DMA/20211019-140347
git checkout 8244d69587ec2d94d34a75f5a3865d250e6880c7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
clang-analyzer warnings: (new ones prefixed by >>)
^
drivers/scsi/ufs/ufshcd.c:5223:35: note: Access to field 'cmd_active' results in a dereference of a null pointer (loaded from field 'active_uic_cmd')
hba->active_uic_cmd->cmd_active = 0;
~~~~~~~~~~~~~~ ^
Suppressed 19 warnings (18 in non-user code, 1 with check filters).
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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
6 warnings generated.
drivers/extcon/extcon-max77843.c:837:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
ret = regmap_update_bits(max77843->regmap_muic,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/extcon/extcon-max77843.c:837:2: note: Value stored to 'ret' is never read
ret = regmap_update_bits(max77843->regmap_muic,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 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.
6 warnings generated.
Suppressed 6 warnings (6 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
Suppressed 4 warnings (4 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
7 warnings generated.
drivers/i2c/busses/i2c-pxa.c:1334:32: warning: Value stored to 'bri' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct i2c_bus_recovery_info *bri = &i2c->recovery;
^~~ ~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-pxa.c:1334:32: note: Value stored to 'bri' during its initialization is never read
struct i2c_bus_recovery_info *bri = &i2c->recovery;
^~~ ~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-pxa.c:1335:17: warning: Value stored to 'dev' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
struct device *dev = i2c->adap.dev.parent;
^~~ ~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-pxa.c:1335:17: note: Value stored to 'dev' during its initialization is never read
struct device *dev = i2c->adap.dev.parent;
^~~ ~~~~~~~~~~~~~~~~~~~~
Suppressed 5 warnings (5 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.
5 warnings generated.
Suppressed 5 warnings (5 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.
9 warnings generated.
>> drivers/i2c/busses/i2c-qcom-geni.c:508:8: warning: Value stored to 'dma_buf' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
void *dma_buf = &buf;
^~~~~~~ ~~~~
drivers/i2c/busses/i2c-qcom-geni.c:508:8: note: Value stored to 'dma_buf' during its initialization is never read
void *dma_buf = &buf;
^~~~~~~ ~~~~
drivers/i2c/busses/i2c-qcom-geni.c:625:3: warning: 6th function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
geni_i2c_gpi_unmap(gi2c, &msgs[i], tx_buf, tx_addr, rx_buf, rx_addr);
^
drivers/i2c/busses/i2c-qcom-geni.c:647:6: note: 'ret' is >= 0
if (ret < 0) {
^~~
drivers/i2c/busses/i2c-qcom-geni.c:647:2: note: Taking false branch
if (ret < 0) {
^
drivers/i2c/busses/i2c-qcom-geni.c:657:6: note: Assuming field 'se_mode' is equal to I2C_GPI_DMA
if (gi2c->se_mode == I2C_GPI_DMA) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-qcom-geni.c:657:2: note: Taking true branch
if (gi2c->se_mode == I2C_GPI_DMA) {
^
drivers/i2c/busses/i2c-qcom-geni.c:658:9: note: Calling 'geni_i2c_gsi_xfer'
ret = geni_i2c_gsi_xfer(gi2c, msgs, num);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-qcom-geni.c:576:22: note: 'rx_addr' declared without an initial value
dma_addr_t tx_addr, rx_addr;
^~~~~~~
drivers/i2c/busses/i2c-qcom-geni.c:582:6: note: Assuming field 'cfg_sent' is true
if (!gi2c->cfg_sent) {
^~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-qcom-geni.c:582:2: note: Taking false branch
if (!gi2c->cfg_sent) {
^
drivers/i2c/busses/i2c-qcom-geni.c:595:14: note: Assuming 'i' is < 'num'
for (i = 0; i < num; i++) {
^~~~~~~
drivers/i2c/busses/i2c-qcom-geni.c:595:2: note: Loop condition is true. Entering loop body
for (i = 0; i < num; i++) {
^
drivers/i2c/busses/i2c-qcom-geni.c:597:3: note: Left side of '&&' is true
dev_dbg(gi2c->se.dev, "msg[%d].len:%d\n", i, gi2c->cur->len);
^
include/linux/dev_printk.h:158:2: note: expanded from macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:128:3: note: expanded from macro 'dev_printk'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:370:7: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
drivers/i2c/busses/i2c-qcom-geni.c:597:3: note: Taking true branch
dev_dbg(gi2c->se.dev, "msg[%d].len:%d\n", i, gi2c->cur->len);
^
include/linux/dev_printk.h:158:2: note: expanded from macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:128:3: note: expanded from macro 'dev_printk'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:370:3: note: expanded from macro '__printk_index_emit'
if (__builtin_constant_p(_fmt) && __builtin_constant_p(_level)) { \
^
drivers/i2c/busses/i2c-qcom-geni.c:597:3: note: '?' condition is true
dev_dbg(gi2c->se.dev, "msg[%d].len:%d\n", i, gi2c->cur->len);
^
include/linux/dev_printk.h:158:2: note: expanded from macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:128:3: note: expanded from macro 'dev_printk'
dev_printk_index_emit(level, fmt); \
^
include/linux/dev_printk.h:105:2: note: expanded from macro 'dev_printk_index_emit'
printk_index_subsys_emit("%s %s: ", level, fmt)
^
include/linux/printk.h:413:2: note: expanded from macro 'printk_index_subsys_emit'
__printk_index_emit(fmt, level, subsys_fmt_prefix)
^
include/linux/printk.h:379:12: note: expanded from macro '__printk_index_emit'
.fmt = __builtin_constant_p(_fmt) ? (_fmt) : NULL, \
^
drivers/i2c/busses/i2c-qcom-geni.c:597:3: note: '?' condition is true
dev_dbg(gi2c->se.dev, "msg[%d].len:%d\n", i, gi2c->cur->len);
^
include/linux/dev_printk.h:158:2: note: expanded from macro 'dev_dbg'
dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)
^
include/linux/dev_printk.h:128:3: note: expanded from macro 'dev_printk'
dev_printk_index_emit(level, fmt); \
vim +/dma_buf +508 drivers/i2c/busses/i2c-qcom-geni.c
8244d69587ec2d9 Vinod Koul 2021-10-19 501
8244d69587ec2d9 Vinod Koul 2021-10-19 502 static int geni_i2c_gpi(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
8244d69587ec2d9 Vinod Koul 2021-10-19 503 struct dma_slave_config *config, dma_addr_t *dma_addr_p,
8244d69587ec2d9 Vinod Koul 2021-10-19 504 void **buf, unsigned int op, struct dma_chan *dma_chan)
8244d69587ec2d9 Vinod Koul 2021-10-19 505 {
8244d69587ec2d9 Vinod Koul 2021-10-19 506 struct gpi_i2c_config *peripheral;
8244d69587ec2d9 Vinod Koul 2021-10-19 507 unsigned int flags;
8244d69587ec2d9 Vinod Koul 2021-10-19 @508 void *dma_buf = &buf;
8244d69587ec2d9 Vinod Koul 2021-10-19 509 dma_addr_t addr;
8244d69587ec2d9 Vinod Koul 2021-10-19 510 enum dma_data_direction map_dirn;
8244d69587ec2d9 Vinod Koul 2021-10-19 511 enum dma_transfer_direction dma_dirn;
8244d69587ec2d9 Vinod Koul 2021-10-19 512 struct dma_async_tx_descriptor *desc;
8244d69587ec2d9 Vinod Koul 2021-10-19 513 int ret;
8244d69587ec2d9 Vinod Koul 2021-10-19 514
8244d69587ec2d9 Vinod Koul 2021-10-19 515 peripheral = config->peripheral_config;
8244d69587ec2d9 Vinod Koul 2021-10-19 516
8244d69587ec2d9 Vinod Koul 2021-10-19 517 dma_buf = i2c_get_dma_safe_msg_buf(msg, 1);
8244d69587ec2d9 Vinod Koul 2021-10-19 518 if (!dma_buf)
8244d69587ec2d9 Vinod Koul 2021-10-19 519 return -ENOMEM;
8244d69587ec2d9 Vinod Koul 2021-10-19 520
8244d69587ec2d9 Vinod Koul 2021-10-19 521 if (op == I2C_WRITE)
8244d69587ec2d9 Vinod Koul 2021-10-19 522 map_dirn = DMA_TO_DEVICE;
8244d69587ec2d9 Vinod Koul 2021-10-19 523 else
8244d69587ec2d9 Vinod Koul 2021-10-19 524 map_dirn = DMA_FROM_DEVICE;
8244d69587ec2d9 Vinod Koul 2021-10-19 525
8244d69587ec2d9 Vinod Koul 2021-10-19 526 addr = dma_map_single(gi2c->se.dev->parent, dma_buf, msg->len, map_dirn);
8244d69587ec2d9 Vinod Koul 2021-10-19 527 if (dma_mapping_error(gi2c->se.dev->parent, addr)) {
8244d69587ec2d9 Vinod Koul 2021-10-19 528 i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
8244d69587ec2d9 Vinod Koul 2021-10-19 529 return -ENOMEM;
8244d69587ec2d9 Vinod Koul 2021-10-19 530 }
8244d69587ec2d9 Vinod Koul 2021-10-19 531
8244d69587ec2d9 Vinod Koul 2021-10-19 532 peripheral->rx_len = msg->len;
8244d69587ec2d9 Vinod Koul 2021-10-19 533 peripheral->op = op;
8244d69587ec2d9 Vinod Koul 2021-10-19 534
8244d69587ec2d9 Vinod Koul 2021-10-19 535 ret = dmaengine_slave_config(dma_chan, config);
8244d69587ec2d9 Vinod Koul 2021-10-19 536 if (ret) {
8244d69587ec2d9 Vinod Koul 2021-10-19 537 dev_err(gi2c->se.dev, "dma config error: %d for op:%d\n", ret, op);
8244d69587ec2d9 Vinod Koul 2021-10-19 538 goto err_config;
8244d69587ec2d9 Vinod Koul 2021-10-19 539 }
8244d69587ec2d9 Vinod Koul 2021-10-19 540
8244d69587ec2d9 Vinod Koul 2021-10-19 541 peripheral->set_config = false;
8244d69587ec2d9 Vinod Koul 2021-10-19 542 peripheral->multi_msg = true;
8244d69587ec2d9 Vinod Koul 2021-10-19 543 flags = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
8244d69587ec2d9 Vinod Koul 2021-10-19 544
8244d69587ec2d9 Vinod Koul 2021-10-19 545 if (op == I2C_WRITE)
8244d69587ec2d9 Vinod Koul 2021-10-19 546 dma_dirn = DMA_MEM_TO_DEV;
8244d69587ec2d9 Vinod Koul 2021-10-19 547 else
8244d69587ec2d9 Vinod Koul 2021-10-19 548 dma_dirn = DMA_DEV_TO_MEM;
8244d69587ec2d9 Vinod Koul 2021-10-19 549
8244d69587ec2d9 Vinod Koul 2021-10-19 550 desc = dmaengine_prep_slave_single(dma_chan, addr, msg->len, dma_dirn, flags);
8244d69587ec2d9 Vinod Koul 2021-10-19 551 if (!desc) {
8244d69587ec2d9 Vinod Koul 2021-10-19 552 dev_err(gi2c->se.dev, "prep_slave_sg failed\n");
8244d69587ec2d9 Vinod Koul 2021-10-19 553 ret = -EIO;
8244d69587ec2d9 Vinod Koul 2021-10-19 554 goto err_config;
8244d69587ec2d9 Vinod Koul 2021-10-19 555 }
8244d69587ec2d9 Vinod Koul 2021-10-19 556
8244d69587ec2d9 Vinod Koul 2021-10-19 557 desc->callback_result = i2c_gsi_cb_result;
8244d69587ec2d9 Vinod Koul 2021-10-19 558 desc->callback_param = gi2c;
8244d69587ec2d9 Vinod Koul 2021-10-19 559
8244d69587ec2d9 Vinod Koul 2021-10-19 560 dmaengine_submit(desc);
8244d69587ec2d9 Vinod Koul 2021-10-19 561 *dma_addr_p = addr;
8244d69587ec2d9 Vinod Koul 2021-10-19 562
8244d69587ec2d9 Vinod Koul 2021-10-19 563 return 0;
8244d69587ec2d9 Vinod Koul 2021-10-19 564
8244d69587ec2d9 Vinod Koul 2021-10-19 565 err_config:
8244d69587ec2d9 Vinod Koul 2021-10-19 566 dma_unmap_single(gi2c->se.dev->parent, addr, msg->len, map_dirn);
8244d69587ec2d9 Vinod Koul 2021-10-19 567 i2c_put_dma_safe_msg_buf(dma_buf, msg, false);
8244d69587ec2d9 Vinod Koul 2021-10-19 568 return ret;
8244d69587ec2d9 Vinod Koul 2021-10-19 569 }
8244d69587ec2d9 Vinod Koul 2021-10-19 570
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
7 months, 4 weeks