Re: [PATCH V1 1/1] ASoC: compress: propagate the error code from the compress framework

From: kernel test robot
Date: Wed Feb 23 2022 - 14:57:55 EST


Hi Raghu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on linux/master broonie-sound/for-next linus/master v5.17-rc5 next-20220222]
[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/Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
base: https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: i386-randconfig-a011 (https://download.01.org/0day-ci/archive/20220224/202202240311.3VkBiyO2-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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/6154c602c715dac9253695c89bebd921f43cc81d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Raghu-Bankapur/ASoC-compress-propagate-the-error-code-from-the-compress-framework/20220223-215509
git checkout 6154c602c715dac9253695c89bebd921f43cc81d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash sound/core/

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

All errors (new ones prefixed by >>):

sound/core/compress_offload.c:34:35: warning: extra tokens at end of #include directive [-Wextra-tokens]
#include <sound/compress_driver.h>ASoC: compress: propagate the error code from the compress framework
^
//
sound/core/compress_offload.c:36:1: error: unknown type name 'Propagate'
Propagate the error code from the compress framework for the timestamp
^
>> sound/core/compress_offload.c:36:14: error: expected ';' after top level declarator
Propagate the error code from the compress framework for the timestamp
^
;
>> sound/core/compress_offload.c:112:23: error: invalid application of 'sizeof' to an incomplete type 'struct snd_compr_file'
data = kzalloc(sizeof(*data), GFP_KERNEL);
^~~~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
INIT_WORK(&(_work)->work, (_func)); \
^~~~~
include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
__INIT_WORK((_work), (_func), 0)
^~~~~
include/linux/workqueue.h:228:16: note: expanded from macro '__INIT_WORK'
__init_work((_work), _onstack); \
^~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
INIT_WORK(&(_work)->work, (_func)); \
^~~~~
include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
__INIT_WORK((_work), (_func), 0)
^~~~~
include/linux/workqueue.h:229:4: note: expanded from macro '__INIT_WORK'
(_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
^~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
INIT_WORK(&(_work)->work, (_func)); \
^~~~~
include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
__INIT_WORK((_work), (_func), 0)
^~~~~
include/linux/workqueue.h:230:22: note: expanded from macro '__INIT_WORK'
lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \
^~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
INIT_WORK(&(_work)->work, (_func)); \
^~~~~
include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
__INIT_WORK((_work), (_func), 0)
^~~~~
include/linux/workqueue.h:231:20: note: expanded from macro '__INIT_WORK'
INIT_LIST_HEAD(&(_work)->entry); \
^~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:252:15: note: expanded from macro '__INIT_DELAYED_WORK'
INIT_WORK(&(_work)->work, (_func)); \
^~~~~
include/linux/workqueue.h:245:15: note: expanded from macro 'INIT_WORK'
__INIT_WORK((_work), (_func), 0)
^~~~~
include/linux/workqueue.h:232:4: note: expanded from macro '__INIT_WORK'
(_work)->func = (_func); \
^~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
>> sound/core/compress_offload.c:118:25: error: incomplete definition of type 'struct snd_compr_file'
INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
~~~~^
include/linux/workqueue.h:267:22: note: expanded from macro 'INIT_DELAYED_WORK'
__INIT_DELAYED_WORK(_work, _func, 0)
^~~~~
include/linux/workqueue.h:253:18: note: expanded from macro '__INIT_DELAYED_WORK'
__init_timer(&(_work)->timer, \
^~~~~
include/linux/timer.h:115:19: note: expanded from macro '__init_timer'
init_timer_key((_timer), (_fn), (_flags), #_timer, &__key);\
^~~~~~
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:120:6: error: incomplete definition of type 'struct snd_compr_file'
data->stream.ops = compr->ops;
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:121:6: error: incomplete definition of type 'struct snd_compr_file'
data->stream.direction = dirn;
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:122:6: error: incomplete definition of type 'struct snd_compr_file'
data->stream.private_data = compr->private_data;
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:123:6: error: incomplete definition of type 'struct snd_compr_file'
data->stream.device = compr;
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:132:6: error: incomplete definition of type 'struct snd_compr_file'
data->stream.runtime = runtime;
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:135:30: error: incomplete definition of type 'struct snd_compr_file'
ret = compr->ops->open(&data->stream);
~~~~^
sound/core/compress_offload.c:82:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data;
^
sound/core/compress_offload.c:148:42: error: incomplete definition of type 'struct snd_compr_file'
struct snd_compr_runtime *runtime = data->stream.runtime;
~~~~^
sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data = f->private_data;
^
sound/core/compress_offload.c:150:32: error: incomplete definition of type 'struct snd_compr_file'
cancel_delayed_work_sync(&data->stream.error_work);
~~~~^
sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data = f->private_data;
^
sound/core/compress_offload.c:156:7: error: incomplete definition of type 'struct snd_compr_file'
data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
~~~~^
sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data = f->private_data;
^
sound/core/compress_offload.c:156:34: error: incomplete definition of type 'struct snd_compr_file'
data->stream.ops->trigger(&data->stream, SNDRV_PCM_TRIGGER_STOP);
~~~~^
sound/core/compress_offload.c:147:9: note: forward declaration of 'struct snd_compr_file'
struct snd_compr_file *data = f->private_data;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.


vim +36 sound/core/compress_offload.c

35
> 36 Propagate the error code from the compress framework for the timestamp
37 query. This error code will be used by the client to handle the
38 error case scenarios gracefully.
39
40 /* struct snd_compr_codec_caps overflows the ioctl bit size for some
41 * architectures, so we need to disable the relevant ioctls.
42 */
43 #if _IOC_SIZEBITS < 14
44 #define COMPR_CODEC_CAPS_OVERFLOW
45 #endif
46
47 /* TODO:
48 * - add substream support for multiple devices in case of
49 * SND_DYNAMIC_MINORS is not used
50 * - Multiple node representation
51 * driver should be able to register multiple nodes
52 */
53
54 struct snd_compr_file {
55 unsigned long caps;
56 struct snd_compr_stream stream;
57 };
58
59 static void error_delayed_work(struct work_struct *work);
60
61 /*
62 * a note on stream states used:
63 * we use following states in the compressed core
64 * SNDRV_PCM_STATE_OPEN: When stream has been opened.
65 * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
66 * calling SNDRV_COMPRESS_SET_PARAMS. Running streams will come to this
67 * state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
68 * SNDRV_PCM_STATE_PREPARED: When a stream has been written to (for
69 * playback only). User after setting up stream writes the data buffer
70 * before starting the stream.
71 * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
72 * decoding/encoding and rendering/capturing data.
73 * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
74 * by calling SNDRV_COMPRESS_DRAIN.
75 * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling
76 * SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling
77 * SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively.
78 */
79 static int snd_compr_open(struct inode *inode, struct file *f)
80 {
81 struct snd_compr *compr;
82 struct snd_compr_file *data;
83 struct snd_compr_runtime *runtime;
84 enum snd_compr_direction dirn;
85 int maj = imajor(inode);
86 int ret;
87
88 if ((f->f_flags & O_ACCMODE) == O_WRONLY)
89 dirn = SND_COMPRESS_PLAYBACK;
90 else if ((f->f_flags & O_ACCMODE) == O_RDONLY)
91 dirn = SND_COMPRESS_CAPTURE;
92 else
93 return -EINVAL;
94
95 if (maj == snd_major)
96 compr = snd_lookup_minor_data(iminor(inode),
97 SNDRV_DEVICE_TYPE_COMPRESS);
98 else
99 return -EBADFD;
100
101 if (compr == NULL) {
102 pr_err("no device data!!!\n");
103 return -ENODEV;
104 }
105
106 if (dirn != compr->direction) {
107 pr_err("this device doesn't support this direction\n");
108 snd_card_unref(compr->card);
109 return -EINVAL;
110 }
111
> 112 data = kzalloc(sizeof(*data), GFP_KERNEL);
113 if (!data) {
114 snd_card_unref(compr->card);
115 return -ENOMEM;
116 }
117
> 118 INIT_DELAYED_WORK(&data->stream.error_work, error_delayed_work);
119
120 data->stream.ops = compr->ops;
121 data->stream.direction = dirn;
122 data->stream.private_data = compr->private_data;
123 data->stream.device = compr;
124 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
125 if (!runtime) {
126 kfree(data);
127 snd_card_unref(compr->card);
128 return -ENOMEM;
129 }
130 runtime->state = SNDRV_PCM_STATE_OPEN;
131 init_waitqueue_head(&runtime->sleep);
132 data->stream.runtime = runtime;
133 f->private_data = (void *)data;
134 mutex_lock(&compr->lock);
135 ret = compr->ops->open(&data->stream);
136 mutex_unlock(&compr->lock);
137 if (ret) {
138 kfree(runtime);
139 kfree(data);
140 }
141 snd_card_unref(compr->card);
142 return ret;
143 }
144

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