Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: buffer: Return error if no callback is given

Return error in case no callback is provided to
`iio_channel_get_all_cb()`. There's no point in setting up a buffer-cb
if no callback is provided.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20201121161457.957-3-nuno.sa@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Nuno Sá and committed by
Jonathan Cameron
6d74a3ee 9afaf9a5

+5
+5
drivers/iio/buffer/industrialio-buffer-cb.c
··· 54 54 struct iio_cb_buffer *cb_buff; 55 55 struct iio_channel *chan; 56 56 57 + if (!cb) { 58 + dev_err(dev, "Invalid arguments: A callback must be provided!\n"); 59 + return ERR_PTR(-EINVAL); 60 + } 61 + 57 62 cb_buff = kzalloc(sizeof(*cb_buff), GFP_KERNEL); 58 63 if (cb_buff == NULL) 59 64 return ERR_PTR(-ENOMEM);