]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
2 years agoASoC: codecs: wcd934x: Add missing of_node_put() in wcd934x_codec_parse_data
Miaoqian Lin [Wed, 16 Mar 2022 08:36:31 +0000 (08:36 +0000)]
ASoC: codecs: wcd934x: Add missing of_node_put() in wcd934x_codec_parse_data

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9531a631379169d57756b2411178c6238655df88 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.
This is similar to commit 64b92de9603f
("ASoC: wcd9335: fix a leaked reference by adding missing of_node_put")

Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220316083631.14103-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2f44eca78cc6d4e1779eb95765ec79e433accab4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: msm8916-wcd-analog: Fix error handling in pm8916_wcd_analog_spmi_probe
Miaoqian Lin [Wed, 16 Mar 2022 04:19:24 +0000 (04:19 +0000)]
ASoC: msm8916-wcd-analog: Fix error handling in pm8916_wcd_analog_spmi_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9ebd62d60edcd4d9c75485e5ccd0b79581ad3c49 ]

In the error handling path, the clk_prepare_enable() function
call should be balanced by a corresponding 'clk_disable_unprepare()'
call , as already done in the remove function.

Fixes: de66b3455023 ("ASoC: codecs: msm8916-wcd-analog: add MBHC support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220316041924.17560-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e2aeafc6509c4567e7b0382825eb956922b66e84)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: atmel: Fix error handling in sam9x5_wm8731_driver_probe
Miaoqian Lin [Wed, 16 Mar 2022 11:15:30 +0000 (11:15 +0000)]
ASoC: atmel: Fix error handling in sam9x5_wm8731_driver_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 740dc3e846537c3743da98bf106f376023fd085c ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error path.

Fixes: fdbcb3cba54b ("ASoC: atmel: machine driver for at91sam9x5-wm8731 boards")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220316111530.4551-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f589063b585ac6dd2081bde6c145411cf48d8d92)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agommc: davinci_mmc: Handle error for clk_enable
Jiasheng Jiang [Tue, 8 Mar 2022 07:14:15 +0000 (15:14 +0800)]
mmc: davinci_mmc: Handle error for clk_enable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 09e7af76db02c74f2a339b3cb2d95460fa2ddbe4 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: bbce5802afc5 ("davinci: mmc: updates to suspend/resume implementation")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220308071415.1093393-1-jiasheng@iscas.ac.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f2b0fc2a46a630289a0c53fdc6135a4051145c99)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital...
Miaoqian Lin [Mon, 7 Mar 2022 08:45:22 +0000 (08:45 +0000)]
ASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 375a347da4889f64d86e1ab7f4e6702b6e9bf299 ]

Fix the missing clk_disable_unprepare() before return
from msm8916_wcd_digital_probe in the error handling case.

Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307084523.28687-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9668c6bca12af33c2ce3a84b0753d71ce6827547)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: SOF: Intel: enable DMI L1 for playback streams
Kai Vehmanen [Thu, 10 Mar 2022 17:16:47 +0000 (11:16 -0600)]
ASoC: SOF: Intel: enable DMI L1 for playback streams

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a174e72e2355b9025205b4b6727bf43047eac6c6 ]

Add back logic to mark all playback streams as L1 compatible.

Fixes: 246dd4287dfb ("ASoC: SOF: Intel: make DMI L1 selection more robust")
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220310171651.249385-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 42735eae94ee4234b952fed393967b1243610202)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: imx-es8328: Fix error return code in imx_es8328_probe()
Wang Wensheng [Thu, 10 Mar 2022 09:19:02 +0000 (09:19 +0000)]
ASoC: imx-es8328: Fix error return code in imx_es8328_probe()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3b891513f95cba3944e72c1139ea706d04f3781b ]

Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: 7e7292dba215 ("ASoC: fsl: add imx-es8328 machine driver")
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
Link: https://lore.kernel.org/r/20220310091902.129299-1-wangwensheng4@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b23b524b8bbd2ac34605a6fd004815104fa8cf6d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: fsl_spdif: Disable TX clock when stop
Shengjiu Wang [Thu, 10 Mar 2022 02:37:43 +0000 (10:37 +0800)]
ASoC: fsl_spdif: Disable TX clock when stop

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6ddf611219ba8f7c8fa0d26b39710a641e7d37a5 ]

The TX clock source may be changed in next case, need to
disable it when stop, otherwise the TX may not work after
changing the clock source, error log is:

aplay: pcm_write:2058: write error: Input/output error

Fixes: a2388a498ad2 ("ASoC: fsl: Add S/PDIF CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1646879863-27711-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 06e6f4ba25343c7dde4e2872603fb28efe69cedf)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: mxs: Fix error handling in mxs_sgtl5000_probe
Miaoqian Lin [Tue, 8 Mar 2022 02:01:44 +0000 (02:01 +0000)]
ASoC: mxs: Fix error handling in mxs_sgtl5000_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6ae0a4d8fec551ec581d620f0eb1fe31f755551c ]

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
For example, when codec_np is NULL, saif_np[0] and saif_np[1]
are not NULL, it will cause leaks.

of_node_put() will check if the node pointer is NULL, so we can
call it directly to release the refcount of regular pointers.

Fixes: e968194b45c4 ("ASoC: mxs: add device tree support for mxs-sgtl5000")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220308020146.26496-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 44acdaf7acb60054d872bed18ce0e7db8ce900ce)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: dmaengine: do not use a NULL prepare_slave_config() callback
Codrin Ciubotariu [Mon, 7 Mar 2022 12:21:57 +0000 (14:21 +0200)]
ASoC: dmaengine: do not use a NULL prepare_slave_config() callback

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9a1e13440a4f2e7566fd4c5eae6a53e6400e08a4 ]

Even if struct snd_dmaengine_pcm_config is used, prepare_slave_config()
callback might not be set. Check if this callback is set before using it.

Fixes: fa654e085300 ("ASoC: dmaengine-pcm: Provide default config")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220307122202.2251639-2-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1ecf9dcf2868aa3f9777ddfdc8d52c47ce0cf93e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: rk817: Fix missing clk_disable_unprepare() in rk817_platform_probe
Miaoqian Lin [Mon, 7 Mar 2022 09:01:30 +0000 (09:01 +0000)]
ASoC: rk817: Fix missing clk_disable_unprepare() in rk817_platform_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a6b44a2518a08348bd0f0401e4d2b99233bbabc2 ]

Fix the missing clk_disable_unprepare() before return
from rk817_platform_probe() in the error handling case.

Fixes: 0d6a04da9b25 ("ASoC: Add Rockchip rk817 audio CODEC support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Tested-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20220307090146.4104-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 39c2894dfc084972d85a6a211ca6ceb69bdc57d9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe
Miaoqian Lin [Tue, 8 Mar 2022 01:52:22 +0000 (01:52 +0000)]
ASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e45ac7831ff3e2934d58cce319c17c8ec763c95c ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: 4e28491a7a19 ("ASoC: mediatek: mt8192-mt6359: fix device_node leak")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220308015224.23585-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 87e04a89c31e792eef62bcba6ebb77fd323d28a1)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: mediatek: use of_device_get_match_data()
Tzung-Bi Shih [Mon, 27 Dec 2021 06:21:53 +0000 (14:21 +0800)]
ASoC: mediatek: use of_device_get_match_data()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3667a037e50a31555276a7989435126e501f0f15 ]

Uses of_device_get_match_data() helper to clean some boilerplate code.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211227062153.3887447-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 56e0f1696a966e16b6eab07d43ce01d37de166ea)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: SOF: Add missing of_node_put() in imx8m_probe
Miaoqian Lin [Tue, 8 Mar 2022 02:33:23 +0000 (02:33 +0000)]
ASoC: SOF: Add missing of_node_put() in imx8m_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5575f7f49134c7386a684335c9007737c606d3b5 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: afb93d716533 ("ASoC: SOF: imx: Add i.MX8M HW support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308023325.31702-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 5441ab46dd431954acb73b9a0533b3a516e3db59)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe
Miaoqian Lin [Mon, 7 Mar 2022 08:35:52 +0000 (08:35 +0000)]
ASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f725d20579807a68afbe5dba69e78b8fa05f5ef0 ]

Fix the missing clk_disable_unprepare() before return
from rockchip_i2s_probe() in the error handling case.

Fixes: 01605ad12875 ("ASoC: rockchip-i2s: enable "hclk" for rockchip I2S controller")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307083553.26009-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6724217bfbfd0186f2d4808dc27cd8e5178a80c2)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: atmel: Fix error handling in snd_proto_probe
Miaoqian Lin [Tue, 8 Mar 2022 01:39:48 +0000 (01:39 +0000)]
ASoC: atmel: Fix error handling in snd_proto_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b0bfaf0544d08d093d6211d7ef8816fb0b5b6c75 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: a45f8853a5f9 ("ASoC: Add driver for PROTO Audio CODEC (with a WM8731)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220308013949.20323-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f32ac9bf5e3f594ef9bfedb410aebc98cf784e69)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoivtv: fix incorrect device_caps for ivtvfb
Hans Verkuil [Sun, 6 Mar 2022 11:29:11 +0000 (12:29 +0100)]
ivtv: fix incorrect device_caps for ivtvfb

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 25e94139218c0293b4375233c14f2256d7dcfaa8 ]

The VIDIOC_G_FBUF and related overlay ioctls no longer worked (-ENOTTY was
returned).

The root cause was the introduction of the caps field in ivtv-driver.h.
While loading the ivtvfb module would update the video_device device_caps
field with V4L2_CAP_VIDEO_OUTPUT_OVERLAY it would not update that caps
field, and that's what the overlay ioctls would look at.

It's a bad idea to keep information in two places, so drop the caps field
and only use vdev.device_caps.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: Martin Dauskardt <martin.dauskardt@gmx.de>
Fixes: 2161536516ed (media: media/pci: set device_caps in struct video_device)
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1e77cab218e4848f2185a404a27ff6117932d1ca)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: saa7134: fix incorrect use to determine if list is empty
Jakob Koschel [Mon, 28 Feb 2022 14:26:26 +0000 (15:26 +0100)]
media: saa7134: fix incorrect use to determine if list is empty

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9f1f4b642451d35667a4dc6a9c0a89d954b530a3 ]

'dev' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the
list is empty.

Instead of checking the pointer it should be checked if
the list is empty.

Fixes: 79dd0c69f05f ("V4L: 925: saa7134 alsa is now a standalone module")
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a8523efdc9463bd1f2c5a85d3ddc49b096e58739)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of
Miaoqian Lin [Mon, 7 Mar 2022 12:38:12 +0000 (12:38 +0000)]
video: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a58c22cfbbf62fefca090334bbd35fd132e92a23 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: f76ee892a99e ("omapfb: copy omapdss & displays for omapfb")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a41fc6d02d82def40332ddd76e5d623a7acaf9cf)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: fsi: Add check for clk_enable
Jiasheng Jiang [Wed, 2 Mar 2022 06:28:44 +0000 (14:28 +0800)]
ASoC: fsi: Add check for clk_enable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 405afed8a728f23cfaa02f75bbc8bdd6b7322123 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220302062844.46869-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c193128099310ff30d81a85343c83b4a5bdfaac1)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: wm8350: Handle error for wm8350_register_irq
Jiasheng Jiang [Fri, 4 Mar 2022 02:38:21 +0000 (10:38 +0800)]
ASoC: wm8350: Handle error for wm8350_register_irq

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit db0350da8084ad549bca16cc0486c11cc70a1f9b ]

As the potential failure of the wm8350_register_irq(),
it should be better to check it and return error if fails.
Also, use 'free_' in order to avoid the same code.

Fixes: a6ba2b2dabb5 ("ASoC: Implement WM8350 headphone jack detection")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220304023821.391936-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0bdb861b7d1b120c35c11d8f0424cbbc67997fe3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe
Miaoqian Lin [Mon, 7 Mar 2022 12:45:39 +0000 (12:45 +0000)]
ASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f590797fa3c1bccdd19e55441592a23b46aef449 ]

This node pointer is returned by of_parse_phandle() with refcount
incremented in this function.
Calling of_node_put() to avoid the refcount leak.

Fixes: 531f67e41dcd ("ASoC: at91sam9g20ek-wm8731: convert to dt support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220307124539.1743-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a0bc36b247dcf4d21bf820bfc4bcbaf7f6cf19b5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: vidtv: Check for null return of vzalloc
Jiasheng Jiang [Fri, 14 Jan 2022 06:28:40 +0000 (07:28 +0100)]
media: vidtv: Check for null return of vzalloc

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e6a21a14106d9718aa4f8e115b1e474888eeba44 ]

As the possible failure of the vzalloc(), e->encoder_buf might be NULL.
Therefore, it should be better to check it in order
to guarantee the success of the initialization.
If fails, we need to free not only 'e' but also 'e->name'.
Also, if the allocation for ctx fails, we need to free 'e->encoder_buf'
else.

Fixes: f90cf6079bf6 ("media: vidtv: add a bridge driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9dd2fd7a1f84c947561af29424c5ddcecfcf2cbe)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: stk1160: If start stream fails, return buffers with VB2_BUF_STATE_QUEUED
Dafna Hirschfeld [Tue, 25 Jan 2022 08:02:11 +0000 (09:02 +0100)]
media: stk1160: If start stream fails, return buffers with VB2_BUF_STATE_QUEUED

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit fbe04b49a54e31f4321d632270207f0e6304cd16 ]

If the callback 'start_streaming' fails, then all
queued buffers in the driver should be returned with
state 'VB2_BUF_STATE_QUEUED'. Currently, they are
returned with 'VB2_BUF_STATE_ERROR' which is wrong.
Fix this. This also fixes the warning:

[   65.583633] WARNING: CPU: 5 PID: 593 at drivers/media/common/videobuf2/videobuf2-core.c:1612 vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.585027] Modules linked in: snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_soc_hdmi_codec dw_hdmi_i2s_audio saa7115 stk1160 videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc crct10dif_ce panfrost snd_soc_simple_card snd_soc_audio_graph_card snd_soc_spdif_tx snd_soc_simple_card_utils gpu_sched phy_rockchip_pcie snd_soc_rockchip_i2s rockchipdrm analogix_dp dw_mipi_dsi dw_hdmi cec drm_kms_helper drm rtc_rk808 rockchip_saradc industrialio_triggered_buffer kfifo_buf rockchip_thermal pcie_rockchip_host ip_tables x_tables ipv6
[   65.589383] CPU: 5 PID: 593 Comm: v4l2src0:src Tainted: G        W         5.16.0-rc4-62408-g32447129cb30-dirty #14
[   65.590293] Hardware name: Radxa ROCK Pi 4B (DT)
[   65.590696] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   65.591304] pc : vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.591850] lr : vb2_start_streaming+0x6c/0x160 [videobuf2_common]
[   65.592395] sp : ffff800012bc3ad0
[   65.592685] x29: ffff800012bc3ad0 x28: 0000000000000000 x27: ffff800012bc3cd8
[   65.593312] x26: 0000000000000000 x25: ffff00000d8a7800 x24: 0000000040045612
[   65.593938] x23: ffff800011323000 x22: ffff800012bc3cd8 x21: ffff00000908a8b0
[   65.594562] x20: ffff00000908a8c8 x19: 00000000fffffff4 x18: ffffffffffffffff
[   65.595188] x17: 000000040044ffff x16: 00400034b5503510 x15: ffff800011323f78
[   65.595813] x14: ffff000013163886 x13: ffff000013163885 x12: 00000000000002ce
[   65.596439] x11: 0000000000000028 x10: 0000000000000001 x9 : 0000000000000228
[   65.597064] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : fefefeff726c5e78
[   65.597690] x5 : ffff800012bc3990 x4 : 0000000000000000 x3 : ffff000009a34880
[   65.598315] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000007cd99f0
[   65.598940] Call trace:
[   65.599155]  vb2_start_streaming+0xd4/0x160 [videobuf2_common]
[   65.599672]  vb2_core_streamon+0x17c/0x1a8 [videobuf2_common]
[   65.600179]  vb2_streamon+0x54/0x88 [videobuf2_v4l2]
[   65.600619]  vb2_ioctl_streamon+0x54/0x60 [videobuf2_v4l2]
[   65.601103]  v4l_streamon+0x3c/0x50 [videodev]
[   65.601521]  __video_do_ioctl+0x1a4/0x428 [videodev]
[   65.601977]  video_usercopy+0x320/0x828 [videodev]
[   65.602419]  video_ioctl2+0x3c/0x58 [videodev]
[   65.602830]  v4l2_ioctl+0x60/0x90 [videodev]
[   65.603227]  __arm64_sys_ioctl+0xa8/0xe0
[   65.603576]  invoke_syscall+0x54/0x118
[   65.603911]  el0_svc_common.constprop.3+0x84/0x100
[   65.604332]  do_el0_svc+0x34/0xa0
[   65.604625]  el0_svc+0x1c/0x50
[   65.604897]  el0t_64_sync_handler+0x88/0xb0
[   65.605264]  el0t_64_sync+0x16c/0x170
[   65.605587] ---[ end trace 578e0ba07742170d ]---

Fixes: 8ac456495a33d ("[media] stk1160: Stop device and unqueue buffers when start_streaming() fails")
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a09e9882800fdfc5aab93f77c3f0132071d2191b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agom68k: coldfire/device.c: only build for MCF_EDMA when h/w macros are defined
Randy Dunlap [Sat, 5 Mar 2022 06:40:36 +0000 (22:40 -0800)]
m68k: coldfire/device.c: only build for MCF_EDMA when h/w macros are defined

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e6e1e7b19fa132d23d09c465942aab4c110d3da9 ]

When CONFIG_MCF_EDMA is set (due to COMPILE_TEST, not due to
CONFIG_M5441x), coldfire/device.c has compile errors due to
missing MCFEDMA_* symbols. In the .config file that was provided,
CONFIG_M5206=y, not CONFIG_M5441x, so <asm/m5441xsim.h> is not
included in coldfire/device.c.

Only build the MCF_EDMA code in coldfire/device.c if the MCFEDMA_*
hardware macros are defined.

Fixes these build errors:

../arch/m68k/coldfire/device.c:512:35: error: 'MCFEDMA_BASE' undeclared here (not in a function); did you mean 'MCFDMA_BASE1'?
  512 |                 .start          = MCFEDMA_BASE,
../arch/m68k/coldfire/device.c:513:50: error: 'MCFEDMA_SIZE' undeclared here (not in a function)
  513 |                 .end            = MCFEDMA_BASE + MCFEDMA_SIZE - 1,
../arch/m68k/coldfire/device.c:517:35: error: 'MCFEDMA_IRQ_INTR0' undeclared here (not in a function)
  517 |                 .start          = MCFEDMA_IRQ_INTR0,
../arch/m68k/coldfire/device.c:523:35: error: 'MCFEDMA_IRQ_INTR16' undeclared here (not in a function)
  523 |                 .start          = MCFEDMA_IRQ_INTR16,
../arch/m68k/coldfire/device.c:529:35: error: 'MCFEDMA_IRQ_INTR56' undeclared here (not in a function)
  529 |                 .start          = MCFEDMA_IRQ_INTR56,
../arch/m68k/coldfire/device.c:535:35: error: 'MCFEDMA_IRQ_ERR' undeclared here (not in a function)
  535 |                 .start          = MCFEDMA_IRQ_ERR,

Fixes: d7e9d01ac292 ("m68k: add ColdFire mcf5441x eDMA platform support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Link: lore.kernel.org/r/202203030252.P752DK46-lkp@intel.com
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: Greg Ungerer <gerg@kernel.org>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: uclinux-dev@uclinux.org
Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ea2258664ffcde0d5c6836e70e685696f35af75a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: rockchip: Fix SDIO regulator supply properties on rk3399-firefly
Rob Herring [Fri, 4 Mar 2022 20:25:58 +0000 (14:25 -0600)]
arm64: dts: rockchip: Fix SDIO regulator supply properties on rk3399-firefly

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 37cbd3c522869247ed4525b5042ff4c6a276c813 ]

A label reference without brackets is a path string, not a phandle as
intended. Add the missing brackets.

Fixes: a5002c41c383 ("arm64: dts: rockchip: add WiFi module support for Firefly-RK3399")
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220304202559.317749-1-robh@kernel.org
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 178b32112be1384e488b42f5d8eced8c6b814aab)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction
Takashi Sakamoto [Fri, 4 Mar 2022 12:56:47 +0000 (21:56 +0900)]
ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bf0cd60b7e33cf221fbe1114e4acb2c828b0af0d ]

AV/C deferred transaction was supported at a commit 00a7bb81c20f ("ALSA:
firewire-lib: Add support for deferred transaction") while 'deferrable'
flag can be uninitialized for non-control/notify AV/C transactions.
UBSAN reports it:

kernel: ================================================================================
kernel: UBSAN: invalid-load in /build/linux-aa0B4d/linux-5.15.0/sound/firewire/fcp.c:363:9
kernel: load of value 158 is not a valid value for type '_Bool'
kernel: CPU: 3 PID: 182227 Comm: irq/35-firewire Tainted: P           OE     5.15.0-18-generic #18-Ubuntu
kernel: Hardware name: Gigabyte Technology Co., Ltd. AX370-Gaming 5/AX370-Gaming 5, BIOS F42b 08/01/2019
kernel: Call Trace:
kernel:  <IRQ>
kernel:  show_stack+0x52/0x58
kernel:  dump_stack_lvl+0x4a/0x5f
kernel:  dump_stack+0x10/0x12
kernel:  ubsan_epilogue+0x9/0x45
kernel:  __ubsan_handle_load_invalid_value.cold+0x44/0x49
kernel:  fcp_response.part.0.cold+0x1a/0x2b [snd_firewire_lib]
kernel:  fcp_response+0x28/0x30 [snd_firewire_lib]
kernel:  fw_core_handle_request+0x230/0x3d0 [firewire_core]
kernel:  handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? handle_ar_packet+0x1d9/0x200 [firewire_ohci]
kernel:  ? transmit_complete_callback+0x9f/0x120 [firewire_core]
kernel:  ar_context_tasklet+0xa8/0x2e0 [firewire_ohci]
kernel:  tasklet_action_common.constprop.0+0xea/0xf0
kernel:  tasklet_action+0x22/0x30
kernel:  __do_softirq+0xd9/0x2e3
kernel:  ? irq_finalize_oneshot.part.0+0xf0/0xf0
kernel:  do_softirq+0x75/0xa0
kernel:  </IRQ>
kernel:  <TASK>
kernel:  __local_bh_enable_ip+0x50/0x60
kernel:  irq_forced_thread_fn+0x7e/0x90
kernel:  irq_thread+0xba/0x190
kernel:  ? irq_thread_fn+0x60/0x60
kernel:  kthread+0x11e/0x140
kernel:  ? irq_thread_check_affinity+0xf0/0xf0
kernel:  ? set_kthread_struct+0x50/0x50
kernel:  ret_from_fork+0x22/0x30
kernel:  </TASK>
kernel: ================================================================================

This commit fixes the bug. The bug has no disadvantage for the non-
control/notify AV/C transactions since the flag has an effect for AV/C
response with INTERIM (0x0f) status which is not used for the transactions
in AV/C general specification.

Fixes: 00a7bb81c20f ("ALSA: firewire-lib: Add support for deferred transaction")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20220304125647.78430-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit eab74c41612083bd627b60da650e19234e4f1051)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomemory: emif: check the pointer temp in get_device_details()
Jia-Ju Bai [Fri, 25 Feb 2022 13:25:52 +0000 (05:25 -0800)]
memory: emif: check the pointer temp in get_device_details()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5b5ab1bfa1898c6d52936a57c25c5ceba2cb2f87 ]

The pointer temp is allocated by devm_kzalloc(), so it should be
checked for error handling.

Fixes: 7ec944538dde ("memory: emif: add basic infrastructure for EMIF driver")
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225132552.27894-1-baijiaju1990@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2883fb9838fcfbe84d4c34e25ed0147f22de7767)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomemory: emif: Add check for setup_interrupts
Jiasheng Jiang [Thu, 24 Feb 2022 02:54:44 +0000 (10:54 +0800)]
memory: emif: Add check for setup_interrupts

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit fd7bd80b46373887b390852f490f21b07e209498 ]

As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value of the
setup_interrupts() and return error if fails.

Fixes: 68b4aee35d1f ("memory: emif: add interrupt and temperature handling")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220224025444.3256530-1-jiasheng@iscas.ac.cn
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 50d934cea57456f1085f16a412434f8d44b49eb5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: soc-compress: prevent the potentially use of null pointer
Jiasheng Jiang [Fri, 15 Oct 2021 08:13:53 +0000 (08:13 +0000)]
ASoC: soc-compress: prevent the potentially use of null pointer

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit de2c6f98817fa5decb9b7d3b3a8a3ab864c10588 ]

There is one call trace that snd_soc_register_card()
->snd_soc_bind_card()->soc_init_pcm_runtime()
->snd_soc_dai_compress_new()->snd_soc_new_compress().
In the trace the 'codec_dai' transfers from card->dai_link,
and we can see from the snd_soc_add_pcm_runtime() in
snd_soc_bind_card() that, if value of card->dai_link->num_codecs
is 0, then 'codec_dai' could be null pointer caused
by index out of bound in 'asoc_rtd_to_codec(rtd, 0)'.
And snd_soc_register_card() is called by various platforms.
Therefore, it is better to add the check in the case of misusing.
And because 'cpu_dai' has already checked in soc_init_pcm_runtime(),
there is no need to check again.
Adding the check as follow, then if 'codec_dai' is null,
snd_soc_new_compress() will not pass through the check
'if (playback + capture != 1)', avoiding the leftover use of
'codec_dai'.

Fixes: 467fece ("ASoC: soc-dai: move snd_soc_dai_stream_valid() to soc-dai.c")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1634285633-529368-1-git-send-email-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit fc237b8d624f4bcb0f21a532627ce4e3b3a85569)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: dwc-i2s: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 08:47:42 +0000 (16:47 +0800)]
ASoC: dwc-i2s: Handle errors for clk_enable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 45ea97d74313bae681328b0c36fa348036777644 ]

As the potential failure of the clk_enable(),
it should be better to check it, as same as clk_prepare_enable().

Fixes: c9afc1834e81 ("ASoC: dwc: Disallow building designware_pcm as a module")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301084742.3751939-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d70d4a3ff5f21a5ba4a1bf70e48ad9e38d8ea8d6)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: atmel_ssc_dai: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 09:06:37 +0000 (17:06 +0800)]
ASoC: atmel_ssc_dai: Handle errors for clk_enable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f9e2ca0640e59d19af0ff285ee5591ed39069b09 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error if fals.

Fixes: cbaadf0f90d6 ("ASoC: atmel_ssc_dai: refactor the startup and shutdown")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301090637.3776558-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 58b64ee386374b80b2920f7da15b8961e296d66d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: mxs-saif: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 08:17:17 +0000 (16:17 +0800)]
ASoC: mxs-saif: Handle errors for clk_enable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 2ecf362d220317debf5da376e0390e9f7a3f7b29 ]

As the potential failure of the clk_enable(),
it should be better to check it, like mxs_saif_trigger().

Fixes: d0ba4c014934 ("ASoC: mxs-saif: set a base clock rate for EXTMASTER mode work")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301081717.3727190-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 152d62d809601a2545784b89e3f2a5a81ec6e3ee)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoprintk: fix return value of printk.devkmsg __setup handler
Randy Dunlap [Mon, 28 Feb 2022 22:05:56 +0000 (14:05 -0800)]
printk: fix return value of printk.devkmsg __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b665eae7a788c5e2bc10f9ac3c0137aa0ad1fc97 ]

If an invalid option value is used with "printk.devkmsg=<value>",
it is silently ignored.
If a valid option value is used, it is honored but the wrong return
value (0) is used, indicating that the command line option had an
error and was not handled. This string is not added to init's
environment strings due to init/main.c::unknown_bootoption()
checking for a '.' in the boot option string and then considering
that string to be an "Unused module parameter".

Print a warning message if a bad option string is used.
Always return 1 from the __setup handler to indicate that the command
line option has been handled.

Fixes: 750afe7babd1 ("printk: add kernel parameter to control writes to /dev/kmsg")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220228220556.23484-1-rdunlap@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f64c5b235b474ca4aa5ffab32474ec62fa213ac7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: broadcom: Fix sata nodename
Frank Wunderlich [Tue, 1 Mar 2022 15:24:18 +0000 (16:24 +0100)]
arm64: dts: broadcom: Fix sata nodename

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 55927cb44db43a57699fa652e2437a91620385dc ]

After converting ahci-platform txt binding to yaml nodename is reported
as not matching the standard:

arch/arm64/boot/dts/broadcom/northstar2/ns2-svk.dt.yaml:
ahci@663f2000: $nodename:0: 'ahci@663f2000' does not match '^sata(@.*)?$'

Fix it to match binding.

Fixes: ac9aae00f0fc ("arm64: dts: Add SATA3 AHCI and SATA3 PHY DT nodes for NS2")
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0fbd610e68c20d8f52134bb4df11a012ce272eba)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: ns2: Fix spi-cpol and spi-cpha property
Kuldeep Singh [Mon, 28 Feb 2022 11:09:03 +0000 (16:39 +0530)]
arm64: dts: ns2: Fix spi-cpol and spi-cpha property

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c953c764e505428f59ffe6afb1c73b89b5b1ac35 ]

Broadcom ns2 platform has spi-cpol and spi-cpho properties set
incorrectly. As per spi-slave-peripheral-prop.yaml, these properties are
of flag or boolean type and not integer type. Fix the values.

Fixes: d69dbd9f41a7c (arm64: dts: Add ARM PL022 SPI DT nodes for NS2)
Signed-off-by: Kuldeep Singh <singh.kuldeep87k@gmail.com>
CC: Ray Jui <rjui@broadcom.com>
CC: Scott Branden <sbranden@broadcom.com>
CC: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit de64846df9fefaae5acc4e2a090eba9973a9e1a1)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoALSA: spi: Add check for clk_enable()
Jiasheng Jiang [Mon, 28 Feb 2022 02:28:39 +0000 (10:28 +0800)]
ALSA: spi: Add check for clk_enable()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ca1697eb09208f0168d94b88b72f57505339cbe5 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: 3568459a5113 ("ALSA: at73c213: manage SSC clock")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220228022839.3547266-1-jiasheng@iscas.ac.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b98940965dafd89757e408af138467dbdd9fa5c5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: ti: davinci-i2s: Add check for clk_enable()
Jiasheng Jiang [Mon, 28 Feb 2022 03:15:40 +0000 (11:15 +0800)]
ASoC: ti: davinci-i2s: Add check for clk_enable()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ed7c9fef11931fc5d32a83d68017ff390bf5c280 ]

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: 5f9a50c3e55e ("ASoC: Davinci: McBSP: add device tree support for McBSP")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220228031540.3571959-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 89676d9e8c84f705ca30c9c03d78d1f1f635bf03)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agommc: sdhci_am654: Fix the driver data of AM64 SoC
Aswath Govindraju [Fri, 11 Feb 2022 07:50:55 +0000 (13:20 +0530)]
mmc: sdhci_am654: Fix the driver data of AM64 SoC

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3b7340f1c89cc488e4df0b033bf7ae502ebbf5b2 ]

The MMCSD IPs used in AM64 are the same as the ones used in J721E.
Therefore, fix this by using the driver data from J721E for AM64 too, for
both 8 and 4 bit instances.

Fixes: 754b7f2f7d2a ("mmc: sdhci_am654: Add Support for TI's AM64 SoC")
Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Link: https://lore.kernel.org/r/20220211075056.26179-1-a-govindraju@ti.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0a96bff46a5e55e2e0f7f254016343460ff24ab5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosoc: mediatek: pm-domains: Add wakeup capacity support in power domain
Chun-Jie Chen [Sun, 30 Jan 2022 01:21:01 +0000 (09:21 +0800)]
soc: mediatek: pm-domains: Add wakeup capacity support in power domain

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ac0ca395543af061f7ad77afcda0afb323d82468 ]

Due to some power domain needs to keep on for wakeup in system suspend,
so add GENPD_FLAG_ACTIVE_WAKEUP support in Mediatek power domain driver.

Fixes: 59b644b01cf4 ("soc: mediatek: Add MediaTek SCPSYS power domains")
Signed-off-by: Chun-Jie Chen <chun-jie.chen@mediatek.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220130012104.5292-3-chun-jie.chen@mediatek.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7c31acd9ca79efe6e4209d337bf7ff68e7d6f15a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: rt5663: check the return value of devm_kzalloc() in rt5663_parse_dp()
Jia-Ju Bai [Fri, 25 Feb 2022 13:10:30 +0000 (05:10 -0800)]
ASoC: rt5663: check the return value of devm_kzalloc() in rt5663_parse_dp()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4d06f92f38b799295ae22c98be7a20cac3e2a1a7 ]

The function devm_kzalloc() in rt5663_parse_dp() can fail, so its return
value should be checked.

Fixes: 457c25efc592 ("ASoC: rt5663: Add the function of impedance sensing")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225131030.27248-1-baijiaju1990@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9db7423703049bef60d69df6f84a60c50b4d416a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agouaccess: fix nios2 and microblaze get_user_8()
Arnd Bergmann [Tue, 15 Feb 2022 14:37:37 +0000 (15:37 +0100)]
uaccess: fix nios2 and microblaze get_user_8()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a97b693c3712f040c5802f32b2d685352e08cefa ]

These two architectures implement 8-byte get_user() through
a memcpy() into a four-byte variable, which won't fit.

Use a temporary 64-bit variable instead here, and use a double
cast the way that risc-v and openrisc do to avoid compile-time
warnings.

Fixes: 6a090e97972d ("arch/microblaze: support get_user() of size 8 bytes")
Fixes: 5ccc6af5e88e ("nios2: Memory management")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Dinh Nguyen <dinguyen@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3fa8114be4a23da00d56e085e3a4157a985673d7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovsprintf: Fix %pK with kptr_restrict == 0
Christophe Leroy [Thu, 17 Feb 2022 08:49:59 +0000 (09:49 +0100)]
vsprintf: Fix %pK with kptr_restrict == 0

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 84842911322fc6a02a03ab9e728a48c691fe3efd ]

Although kptr_restrict is set to 0 and the kernel is booted with
no_hash_pointers parameter, the content of /proc/vmallocinfo is
lacking the real addresses.

  / # cat /proc/vmallocinfo
  0x(ptrval)-0x(ptrval)    8192 load_module+0xc0c/0x2c0c pages=1 vmalloc
  0x(ptrval)-0x(ptrval)   12288 start_kernel+0x4e0/0x690 pages=2 vmalloc
  0x(ptrval)-0x(ptrval)   12288 start_kernel+0x4e0/0x690 pages=2 vmalloc
  0x(ptrval)-0x(ptrval)    8192 _mpic_map_mmio.constprop.0+0x20/0x44 phys=0x80041000 ioremap
  0x(ptrval)-0x(ptrval)   12288 _mpic_map_mmio.constprop.0+0x20/0x44 phys=0x80041000 ioremap
    ...

According to the documentation for /proc/sys/kernel/, %pK is
equivalent to %p when kptr_restrict is set to 0.

Fixes: 5ead723a20e0 ("lib/vsprintf: no_hash_pointers prints all addresses as unhashed")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/107476128e59bff11a309b5bf7579a1753a41aca.1645087605.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 469277ff5ac8058c2e716bca7a4cda5a4a5c1d9b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agolib: uninline simple_strntoull() as well
Alexey Dobriyan [Tue, 9 Nov 2021 02:33:22 +0000 (18:33 -0800)]
lib: uninline simple_strntoull() as well

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 839b395eb9c13ae56ea5fc3ca9802734a72293f0 ]

Codegen become bloated again after simple_strntoull() introduction

add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-224 (-224)
Function                                     old     new   delta
simple_strtoul                                 5       2      -3
simple_strtol                                 23      20      -3
simple_strtoull                              119      15    -104
simple_strtoll                               155      41    -114

Link: https://lkml.kernel.org/r/YVmlB9yY4lvbNKYt@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8611161ea715866e777b8bb0f01cb46a4432c5b4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests/lkdtm: Add UBSAN config
Muhammad Usama Anjum [Fri, 21 Jan 2022 14:51:53 +0000 (19:51 +0500)]
selftests/lkdtm: Add UBSAN config

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1900be289b598b2c553b3add13e491c0bb8a8550 ]

UBSAN_BOUNDS and UBSAN_TRAP depend on UBSAN config option.
merge_config.sh script generates following warnings if parent config
doesn't have UBSAN config already enabled and UBSAN_BOUNDS/UBSAN_TRAP
config options don't get added to the parent config.

Value requested for CONFIG_UBSAN_BOUNDS not in final .config
Requested value:  CONFIG_UBSAN_BOUNDS=y
Actual value:

Value requested for CONFIG_UBSAN_TRAP not in final .config
Requested value:  CONFIG_UBSAN_TRAP=y
Actual value:

Fix this by including UBSAN config.

Fixes: c75be56e35b2 ("lkdtm/bugs: Add ARRAY_BOUNDS to selftests")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 34dd193d2329cc9b3d0db1cfd9fa6569b130aaff)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: ov5640: Fix set format, v4l2_mbus_pixelcode not updated
Mirela Rabulea [Mon, 1 Nov 2021 19:52:51 +0000 (21:52 +0200)]
media: ov5640: Fix set format, v4l2_mbus_pixelcode not updated

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e738f5dd67eb8098d75345908a5e73782d0569a5 ]

In ov5640_set_fmt, pending_fmt_change will always be false, because the
sensor format is saved before comparing it with the previous format:
fmt = &sensor->fmt;...
*fmt = *mbus_fmt;...
if (mbus_fmt->code != sensor->fmt.code)
sensor->pending_fmt_change = true;
This causes the sensor to capture with the previous pixelcode.

Also, changes might happen even for V4L2_SUBDEV_FORMAT_TRY, so fix that.

Basically, revert back to the state before
commit 071154499193 ("media: ov5640: Fix set format regression")
as it was more clear, and then update format even when pixelcode does
not change, as resolution might change.

Fixes: 071154499193 ("media: ov5640: Fix set format regression")
Fixes: 6949d864776e ("media: ov5640: do not change mode if format or frame interval is unchanged")
Fixes: fb98e29ff1ea5 ("media: ov5640: fix mode change regression")
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f58159509b6251a2f80e281dffb8be338ed3c039)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: v4l2-core: Initialize h264 scaling matrix
Nicolas Dufresne [Fri, 18 Feb 2022 18:42:07 +0000 (13:42 -0500)]
media: v4l2-core: Initialize h264 scaling matrix

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0f6146d476fc99862899e70f2554ee77b444b7b9 ]

In the final H264 API, it is not required to set scaling matrix if
they are not present in the bitstream. A flag was added in order to let
the driver know. The downside is that it leaves the default control
value to 0, which isn't valid. As per the spec (see formulas 7-8/7-9),
when the scaling matrix are absent from the bitstream, flat values
of 16 should be used. This improves this control semantic in a way
that the control value are always valid. Drivers can then use
the scaling_matrix control values without having to check its presence.
Same method was employed for MPEG2_QUANTISATION.

This fixes issues with MTK VCODEC H264 decoder when using GStreamer.
GStreamer does not set this control if its not present in the bitstream.
As MTK VDCODEC was using the initialized to 0 values, the frames ended
up completely gray.

Fixes: 54889c51b833d236 ("media: uapi: h264: Rename and clarify PPS_FLAG_SCALING_MATRIX_PRESENT")
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b1b91b31627d82529b8276e618cdde1c516ca948)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: wcd934x: fix return value of wcd934x_rx_hph_mode_put
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:12 +0000 (18:32 +0000)]
ASoC: codecs: wcd934x: fix return value of wcd934x_rx_hph_mode_put

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4b0bec6088588a120d33db85b1f0d9f096d1df71 ]

wcd934x_rx_hph_mode_put currently returns zero eventhough it changes the value.
Fix this, so that change notifications are sent correctly.

Fixes: 1cde8b822332 ("ASoC: wcd934x: add basic controls")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-10-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7399b9b62277a19381bbd98ff2d1e4fcfbba959f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: wcd934x: fix kcontrol max values
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:11 +0000 (18:32 +0000)]
ASoC: codecs: wcd934x: fix kcontrol max values

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 61163c3e7480106804269182e24db05244866493 ]

set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX.
set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as
max field is integer type.

Without this patch amixer for these controls will show -1 as max value to userspace.

Fixes: 9fb9b1690f0b ("ASoC: codecs: wcd934x: add mbhc support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-9-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c42e96af49ef083275a07c44d0000c98366959a7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: wcd938x: fix kcontrol max values
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:10 +0000 (18:32 +0000)]
ASoC: codecs: wcd938x: fix kcontrol max values

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b0217519236924f77a8382b4004e43ef8fd0dcbb ]

set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MAX.
set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as
max field is integer type.

Without this patch amixer for these controls will show -1 as max value to userspace.

Fixes: bcee7ed09b8e ("ASoC: codecs: wcd938x: add Multi Button Headset Control support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-8-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 363490abe0be17a0e8ac6f54f6332cc6f75abce6)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: wc938x: fix accessing array out of bounds for enum type
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:09 +0000 (18:32 +0000)]
ASoC: codecs: wc938x: fix accessing array out of bounds for enum type

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit cc587b7c8fbbe128f6bd0dad025a0caea5e6d164 ]

Accessing enums using integer would result in array out of bounds access
on platforms like aarch64 where sizeof(long) is 8 compared to enum size
which is 4 bytes.

Fix this by using enumerated items instead of integers.

Fixes: e8ba1e05bdc0 ("ASoC: codecs: wcd938x: add basic controls")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-7-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit adafea71b49ec4dbc44e0b84ec6eb602004a7a08)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: va-macro: fix accessing array out of bounds for enum type
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:07 +0000 (18:32 +0000)]
ASoC: codecs: va-macro: fix accessing array out of bounds for enum type

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0ea5eff7c6063a8f124188424f8e4c6727f35051 ]

Accessing enums using integer would result in array out of bounds access
on platforms like aarch64 where sizeof(long) is 8 compared to enum size
which is 4 bytes.

Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-5-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 966408e37d84b762d11978b7bfb03fff0c6222ad)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: rx-macro: fix accessing array out of bounds for enum type
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:05 +0000 (18:32 +0000)]
ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bcfe5f76cc4051ea3f9eb5d2c8ea621641f290a5 ]

Accessing enums using integer would result in array out of bounds access
on platforms like aarch64 where sizeof(long) is 8 compared to enum size
which is 4 bytes.

Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit eb15c6ea692fd88d70698d874d9a0d667fb4cde9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: rx-macro: fix accessing compander for aux
Srinivas Kandagatla [Tue, 22 Feb 2022 18:32:04 +0000 (18:32 +0000)]
ASoC: codecs: rx-macro: fix accessing compander for aux

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 42c709c4e1ce4c136891530646c9abd5dff3524f ]

AUX interpolator does not have compander, so check before accessing
compander data for this.

Without this checkan array of out bounds access will be made in
comp_enabled[] array.

Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220222183212.11580-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9208ecc703b5ed5b12d7ea13c79207f4c8456638)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: cedrus: h264: Fix neighbour info buffer size
Jernej Skrabec [Mon, 14 Feb 2022 19:08:39 +0000 (20:08 +0100)]
media: cedrus: h264: Fix neighbour info buffer size

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit fecd363ae2d5042553370b0adf60c47e35c34a83 ]

According to BSP library source, H264 neighbour info buffer size needs
to be 32 kiB for H6. This is similar to H265 decoding, which also needs
double buffer size in comparison to older Cedrus core generations.

Increase buffer size to cover H6 needs. Since increase is not that big
in absolute numbers, it doesn't make sense to complicate logic for older
generations.

Issue was discovered using iommu and cross checked with BSP library
source.

Fixes: 6eb9b758e307 ("media: cedrus: Add H264 decoding support")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 56dcb5480687cd151868d400bd316e03eae89036)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: cedrus: H265: Fix neighbour info buffer size
Jernej Skrabec [Sat, 12 Feb 2022 07:42:41 +0000 (08:42 +0100)]
media: cedrus: H265: Fix neighbour info buffer size

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ee8b887329c78971967506f3ac79b9302c9f83c1 ]

Neighbour info buffer size needs to be 794 kiB in H6. This is actually
already indirectly mentioned in the comment, but smaller size is used
nevertheless.

Increase buffer size to cover H6 needs. Since increase is not that big
in absolute numbers, it doesn't make sense to complicate logic for older
generations.

Bug was discovered using iommu, which reported access error when trying
to play H265 video.

Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support")
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit dd6454742581a070fd3de41f98c353ea5d8ef42d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: usb: go7007: s2250-board: fix leak in probe()
Dan Carpenter [Wed, 2 Feb 2022 17:52:01 +0000 (20:52 +0300)]
media: usb: go7007: s2250-board: fix leak in probe()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 67e4550ecd6164bfbdff54c169e5bbf9ccfaf14d ]

Call i2c_unregister_device(audio) on this error path.

Fixes: d3b2ccd9e307 ("[media] s2250: convert to the control framework")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 895364fa97e60749855f789bc4568883fc7a8b39)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: em28xx: initialize refcount before kref_get
Dongliang Mu [Sat, 22 Jan 2022 07:44:59 +0000 (15:44 +0800)]
media: em28xx: initialize refcount before kref_get

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c08eadca1bdfa099e20a32f8fa4b52b2f672236d ]

The commit 47677e51e2a4("[media] em28xx: Only deallocate struct
em28xx after finishing all extensions") adds kref_get to many init
functions (e.g., em28xx_audio_init). However, kref_init is called too
late in em28xx_usb_probe, since em28xx_init_dev before will invoke
those init functions and call kref_get function. Then refcount bug
occurs in my local syzkaller instance.

Fix it by moving kref_init before em28xx_init_dev. This issue occurs
not only in dev but also dev->dev_next.

Fixes: 47677e51e2a4 ("[media] em28xx: Only deallocate struct em28xx after finishing all extensions")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 332d45fe51d75a3a95c4a04e2cb7bffef284edd4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: ti-vpe: cal: Fix a NULL pointer dereference in cal_ctx_v4l2_init_formats()
Zhou Qingyang [Mon, 24 Jan 2022 17:20:01 +0000 (18:20 +0100)]
media: ti-vpe: cal: Fix a NULL pointer dereference in cal_ctx_v4l2_init_formats()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit abd77889851d2ead0d0c9c4d29f1808801477b00 ]

In cal_ctx_v4l2_init_formats(), devm_kzalloc() is assigned to
ctx->active_fmt and there is a dereference of it after that, which could
lead to NULL pointer dereference on failure of devm_kzalloc().

Fix this bug by adding a NULL check of ctx->active_fmt.

This bug was found by a static analyzer.

Builds with 'make allyesconfig' show no new warnings, and our static
analyzer no longer warns about this code.

Fixes: 7168155002cf ("media: ti-vpe: cal: Move format handling to cal.c and expose helpers")
Signed-off-by: Zhou Qingyang <zhou1615@umn.edu>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit aa613ac270292e102503e9767882e39200efe608)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: video/hdmi: handle short reads of hdmi info frame.
Tom Rix [Thu, 12 Aug 2021 17:01:46 +0000 (19:01 +0200)]
media: video/hdmi: handle short reads of hdmi info frame.

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4a92fc6e55da5b87cecb572275deaff6ac9dd27e ]

Calling hdmi_infoframe_unpack() with static sizeof(buffer) skips all
the size checking done later in hdmi_infoframe_unpack().  A better
value is the amount of data read into buffer.

Fixes: 480b8b3e42c3 ("video/hdmi: Pass buffer size to infoframe unpack functions")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 12cb301cc5cb681c0ada80dc070bf3e1345e7373)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: mexon-ge2d: fixup frames size in registers
Neil Armstrong [Thu, 3 Jun 2021 08:42:15 +0000 (10:42 +0200)]
media: mexon-ge2d: fixup frames size in registers

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 79e8c421a099bfbcebe59740153e55aa0442ced6 ]

The CLIP, SRC & DST registers are coded to take the pixel/line start & end,
starting from 0. Thus the end should be the width/height minus 1.

It can be an issue with clipping and rotation, where it will add spurious
lines from uninitialized or unwanted data with a shift in the result.

Fixes: 59a635327ca7 ("media: meson: Add M2M driver for the Amlogic GE2D Accelerator Unit")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0d05a58ea3b945491a36b4bc4d925903224141ea)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoARM: dts: imx: Add missing LVDS decoder on M53Menlo
Marek Vasut [Sun, 6 Feb 2022 22:11:23 +0000 (23:11 +0100)]
ARM: dts: imx: Add missing LVDS decoder on M53Menlo

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0c6f71176ea43d6f4003a4d57f7bb518c5ad6145 ]

The M53Menlo display unit uses an LVDS-to-DPI bridge, TI DS90CF364A.
Describe this bridge in DT, otherwise the DT incorrectly describes
DPI panel attached directly to LVDS source.

Fixes: 716be61d1869 ("ARM: dts: imx53: Add Menlosystems M53 board")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 498ab2d70a9d80dfa1ba97f6973c48aac332d9f6)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovsprintf: Fix potential unaligned access
Andy Shevchenko [Thu, 27 Jan 2022 18:12:32 +0000 (20:12 +0200)]
vsprintf: Fix potential unaligned access

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d75b26f880f60ead301e79ba0f4a635c5a60767f ]

The %p4cc specifier in some cases might get an unaligned pointer.
Due to this we need to make copy to local variable once to avoid
potential crashes on some architectures due to improper access.

Fixes: af612e43de6d ("lib/vsprintf: Add support for printing V4L2 and DRM fourccs")
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220127181233.72910-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2305e3460b424342fd658d2e79f5b66aac3b0497)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoARM: dts: sun8i: v3s: Move the csi1 block to follow address order
Paul Kocialkowski [Sat, 5 Feb 2022 18:53:24 +0000 (19:53 +0100)]
ARM: dts: sun8i: v3s: Move the csi1 block to follow address order

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c4af51698c4fb4fc683f2ac67f482cdf9ba2cd13 ]

The csi1 block node was mistakenly added before the gic node, although
its address comes after the gic's. Move the node to its correct
position.

Fixes: 90e048101fa1 ("ARM: dts: sun8i: V3/V3s/S3/S3L: add CSI1 device node")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220205185429.2278860-2-paul.kocialkowski@bootlin.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b4c8675a710ab9fcfef06cff6e0123aaae742c38)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosoc: ti: wkup_m3_ipc: Fix IRQ check in wkup_m3_ipc_probe
Miaoqian Lin [Fri, 14 Jan 2022 06:28:40 +0000 (06:28 +0000)]
soc: ti: wkup_m3_ipc: Fix IRQ check in wkup_m3_ipc_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c3d66a164c726cc3b072232d3b6d87575d194084 ]

platform_get_irq() returns negative error number instead 0 on failure.
And the doc of platform_get_irq() provides a usage example:

    int irq = platform_get_irq(pdev, 0);
    if (irq < 0)
        return irq;

Fix the check of return value to catch errors correctly.

Fixes: cdd5de500b2c ("soc: ti: Add wkup_m3_ipc driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Dave Gerlach <d-gerlach@ti.com>
Link: https://lore.kernel.org/r/20220114062840.16620-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 49db8d166d7ba7f99a77b1b64f30e727b617d7fc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agofirmware: ti_sci: Fix compilation failure when CONFIG_TI_SCI_PROTOCOL is not defined
Christophe JAILLET [Thu, 23 Dec 2021 16:23:00 +0000 (17:23 +0100)]
firmware: ti_sci: Fix compilation failure when CONFIG_TI_SCI_PROTOCOL is not defined

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 043cfff99a18933fda2fb2e163daee73cc07910b ]

Remove an extra ";" which breaks compilation.

Fixes: 53bf2b0e4e4c ("firmware: ti_sci: Add support for getting resource with subtype")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/e6c3cb793e1a6a2a0ae2528d5a5650dfe6a4b6ff.1640276505.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 42dab81e93094eb312a1482a4914d7f5addb8210)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: qcom: sm8350: Correct TCS configuration for apps rsc
Maulik Shah [Sun, 9 Jan 2022 17:25:00 +0000 (22:55 +0530)]
arm64: dts: qcom: sm8350: Correct TCS configuration for apps rsc

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a131255e4ad1ef8d4873ecba21561ba272b2547a ]

Correct the TCS config by updating the number of TCSes for each type.

Cc: devicetree@vger.kernel.org
Fixes: b7e8f433a673 ("arm64: dts: qcom: Add basic devicetree support for SM8350 SoC")
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1641749107-31979-4-git-send-email-quic_mkshah@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 19e4c3b037ffd1e78fe97cc7fe599115a19bb09f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: qcom: sm8150: Correct TCS configuration for apps rsc
Maulik Shah [Sun, 9 Jan 2022 17:24:58 +0000 (22:54 +0530)]
arm64: dts: qcom: sm8150: Correct TCS configuration for apps rsc

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 17ac8af678b6da6a8f1df7da8ebf2c5198741827 ]

Correct the TCS config by updating the number of TCSes for each type.

Cc: devicetree@vger.kernel.org
Fixes: d8cf9372b654 ("arm64: dts: qcom: sm8150: Add apps shared nodes")
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1641749107-31979-2-git-send-email-quic_mkshah@quicinc.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8026415d7f547706f7b3b5ab14de3ed1610db463)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: broadcom: bcm4908: use proper TWD binding
Rafał Miłecki [Wed, 29 Dec 2021 10:23:14 +0000 (11:23 +0100)]
arm64: dts: broadcom: bcm4908: use proper TWD binding

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 33826e9c6ba76b265d4e26cb95493fa27ed78974 ]

Block at <ff800400 0x4c> is a TWD that contains timers, watchdog and
reset. Actual timers happen to be at block beginning but they only span
across the first 0x28 registers. It means the old block description was
incorrect (size 0x3c).

Drop timers binding for now and use documented TWD binding. Timers
should be properly documented and defined as TWD subnode.

Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 17790ef9ad1f33981755daa5223413b9c64ed4b3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: qcom: sm8250: fix PCIe bindings to follow schema
Dmitry Baryshkov [Tue, 14 Dec 2021 23:14:48 +0000 (02:14 +0300)]
arm64: dts: qcom: sm8250: fix PCIe bindings to follow schema

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d60507200485bc778bf6a5556271d784ab09d913 ]

Replace (unused) enable-gpio binding with schema-defined wake-gpios. The
GPIO line is still unused, but at least we'd follow the defined schema.

While we are at it, change perst-gpio property to follow the preferred
naming schema (perst-gpios).

Fixes: 13e948a36db7 ("arm64: dts: qcom: sm8250: Commonize PCIe pins")
Cc: Konrad Dybcio <konrad.dybcio@somainline.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211214231448.2044987-1-dmitry.baryshkov@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit cc3a67e4147ea35e86a38538ad525d394ed50127)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: dts: qcom: sdm845: fix microphone bias properties and values
David Heidelberg [Mon, 13 Dec 2021 19:51:04 +0000 (20:51 +0100)]
arm64: dts: qcom: sdm845: fix microphone bias properties and values

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 625c24460dbbc3b6c9a148c0a30f0830893fc909 ]

replace millivolt with correct microvolt and adjust value to
the minimal value allowed by documentation.

Found with `make qcom/sdm845-oneplus-fajita.dtb`.

Fixes:
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: codec@1: 'qcom,micbias1-microvolt' is a required property
        From schema: Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: codec@1: 'qcom,micbias2-microvolt' is a required property
        From schema: Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: codec@1: 'qcom,micbias3-microvolt' is a required property
        From schema: Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: codec@1: 'qcom,micbias4-microvolt' is a required property
        From schema: Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dt.yaml: codec@1: 'qcom,micbias1-millivolt', 'qcom,micbias2-millivolt', 'qcom,micbias3-millivolt', 'qcom,micbias4-millivolt' do not match any of the regexes: '^.*@[0-9a-f]+$', 'pinctrl-[0-9]+'

Fixes: 27ca1de07dc3 ("arm64: dts: qcom: sdm845: add slimbus nodes")
Signed-off-by: David Heidelberg <david@ixit.cz>
Tested-by: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211213195105.114596-1-david@ixit.cz
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4514dc92a3531139fefcd6424d94dbbace5d58a3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosoc: qcom: aoss: remove spurious IRQF_ONESHOT flags
Daniel Thompson [Thu, 27 Jan 2022 17:35:54 +0000 (17:35 +0000)]
soc: qcom: aoss: remove spurious IRQF_ONESHOT flags

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8030cb9a55688c1339edd284d9d6ce5f9fc75160 ]

Quoting the header comments, IRQF_ONESHOT is "Used by threaded interrupts
which need to keep the irq line disabled until the threaded handler has
been run.". When applied to an interrupt that doesn't request a threaded
irq then IRQF_ONESHOT has a lesser known (undocumented?) side effect,
which it to disable the forced threading of the irq. For "normal" kernels
(without forced threading) then, if there is no thread_fn, then
IRQF_ONESHOT is a nop.

In this case disabling forced threading is not appropriate for this driver
because it calls wake_up_all() and this API cannot be called from
no-thread interrupt handlers on PREEMPT_RT systems (deadlock risk, triggers
sleeping-while-atomic warnings).

Fix this by removing IRQF_ONESHOT.

Fixes: 2209481409b7 ("soc: qcom: Add AOSS QMP driver")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
[bjorn: Added Fixes tag]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220127173554.158111-1-daniel.thompson@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 15565049d729fa87247c5b803746efa3a1d58345)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosoc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem
Miaoqian Lin [Fri, 7 Jan 2022 07:31:26 +0000 (07:31 +0000)]
soc: qcom: ocmem: Fix missing put_device() call in of_get_ocmem

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0ff027027e05a866491bbb53494f0e2a61354c85 ]

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes: 01f937ffc468 ("soc: qcom: ocmem: don't return NULL in of_get_ocmem")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220107073126.2335-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1874365f3c173c8fbe80238e6b89af60f9c54f33)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agosoc: qcom: rpmpd: Check for null return of devm_kcalloc
Jiasheng Jiang [Fri, 31 Dec 2021 09:44:19 +0000 (17:44 +0800)]
soc: qcom: rpmpd: Check for null return of devm_kcalloc

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5a811126d38f9767a20cc271b34db7c8efc5a46c ]

Because of the possible failure of the allocation, data->domains might
be NULL pointer and will cause the dereference of the NULL pointer
later.
Therefore, it might be better to check it and directly return -ENOMEM
without releasing data manually if fails, because the comment of the
devm_kmalloc() says "Memory allocated with this function is
automatically freed on driver detach.".

Fixes: bbe3a66c3f5a ("soc: qcom: rpmpd: Add a Power domain driver to model corners")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211231094419.1941054-1-jiasheng@iscas.ac.cn
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 724376c30af5a57686b223dbcd6188e07d2a1de2)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoARM: dts: qcom: ipq4019: fix sleep clock
Pavel Kubelun [Mon, 20 Dec 2021 17:03:52 +0000 (18:03 +0100)]
ARM: dts: qcom: ipq4019: fix sleep clock

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3d7e7980993d2c1ae42d3d314040fc2de6a9c45f ]

It seems like sleep_clk was copied from ipq806x.
Fix ipq40xx sleep_clk to the value QSDK defines.

Link: https://source.codeaurora.org/quic/qsdk/oss/kernel/linux-msm/commit/?id=d92ec59973484acc86dd24b67f10f8911b4b4b7d
Link: https://patchwork.kernel.org/comment/22721613/
Fixes: bec6ba4cdf2a ("qcom: ipq4019: Add basic board/dts support for IPQ4019 SoC")
Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org> (clock-output-names)
Signed-off-by: Pavel Kubelun <be.dissent@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (removed clock rename)
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211220170352.34591-1-chunkeey@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d761d62022bb384cda8baa2c9ea4141ed02b7ac2)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agofirmware: qcom: scm: Remove reassignment to desc following initializer
Marijn Suijten [Wed, 8 Dec 2021 08:34:21 +0000 (09:34 +0100)]
firmware: qcom: scm: Remove reassignment to desc following initializer

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7823e5aa5d1dd9ed5849923c165eb8f29ad23c54 ]

Member assignments to qcom_scm_desc were moved into struct initializers
in 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers") including
the case in qcom_scm_iommu_secure_ptbl_init, except that the - now
duplicate - assignment to desc was left in place. While not harmful,
remove this unnecessary extra reassignment.

Fixes: 57d3b816718c ("firmware: qcom_scm: Remove thin wrappers")
Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211208083423.22037-2-marijn.suijten@somainline.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b14f6a7d36087a857a0d6b19071511c4d5aa1096)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoARM: dts: Fix OpenBMC flash layout label addresses
Zev Weiss [Wed, 5 Jan 2022 00:37:18 +0000 (16:37 -0800)]
ARM: dts: Fix OpenBMC flash layout label addresses

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e011df3579ac980d840db8e8c3b9431f88ebddab ]

We've ended up with some inconsistencies between the addresses in the
DT node labels and the actual offsets of the partitions; this brings
them back in sync.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Fixes: 529022738c8e ("ARM: dts: Add OpenBMC flash layout")
Fixes: 8dec60e7b8d0 ("ARM: dts: aspeed: Grow u-boot partition 64MiB OpenBMC flash layout")
Reviewed-by: Lei YU <yulei.sh@bytedance.com>
Link: https://lore.kernel.org/r/20220105003718.19888-1-zev@bewilderbeest.net
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6c4cc4d3696653a56d4d26fe531e1fbe60fc25aa)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: fbcvt.c: fix printing in fb_cvt_print_name()
Dan Carpenter [Thu, 16 Sep 2021 13:29:19 +0000 (16:29 +0300)]
video: fbdev: fbcvt.c: fix printing in fb_cvt_print_name()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 78482af095abd9f4f29f1aa3fe575d25c6ae3028 ]

This code has two bugs:
1) "cnt" is 255 but the size of the buffer is 256 so the last byte is
   not used.
2) If we try to print more than 255 characters then "cnt" will be
   negative and that will trigger a WARN() in snprintf(). The fix for
   this is to use scnprintf() instead of snprintf().

We can re-write this code to be cleaner:
1) Rename "offset" to "off" because that's shorter.
2) Get rid of the "cnt" variable and just use "size - off" directly.
3) Get rid of the "read" variable and just increment "off" directly.

Fixes: 96fe6a2109db ("fbdev: Add VESA Coordinated Video Timings (CVT) support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c3364cbc376202cf7b41e95467f4cc0604c4f627)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: atmel_lcdfb: fix an error code in atmel_lcdfb_probe()
Dan Carpenter [Fri, 3 Dec 2021 09:58:08 +0000 (12:58 +0300)]
video: fbdev: atmel_lcdfb: fix an error code in atmel_lcdfb_probe()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit fee5c1e4b789e41719af9fee0e2dd397cd31988f ]

If "sinfo->config" is not found, then return -ENODEV.  Don't
return success.

Fixes: b985172b328a ("video: atmel_lcdfb: add device tree suport")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f3ef254c840de6245a9daff23c5de3c802140dab)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: smscufx: Fix null-ptr-deref in ufx_usb_probe()
Wang Hai [Thu, 14 Oct 2021 13:22:31 +0000 (21:22 +0800)]
video: fbdev: smscufx: Fix null-ptr-deref in ufx_usb_probe()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1791f487f877a9e83d81c8677bd3e7b259e7cb27 ]

I got a null-ptr-deref report:

BUG: kernel NULL pointer dereference, address: 0000000000000000
...
RIP: 0010:fb_destroy_modelist+0x38/0x100
...
Call Trace:
 ufx_usb_probe.cold+0x2b5/0xac1 [smscufx]
 usb_probe_interface+0x1aa/0x3c0 [usbcore]
 really_probe+0x167/0x460
...
 ret_from_fork+0x1f/0x30

If fb_alloc_cmap() fails in ufx_usb_probe(), fb_destroy_modelist() will
be called to destroy modelist in the error handling path. But modelist
has not been initialized yet, so it will result in null-ptr-deref.

Initialize modelist before calling fb_alloc_cmap() to fix this bug.

Fixes: 3c8a63e22a08 ("Add support for SMSC UFX6000/7000 USB display adapters")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c420b540db4b5d69de0a36d8b9d9a6a79a04f05a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: controlfb: Fix COMPILE_TEST build
YueHaibing [Thu, 9 Dec 2021 09:01:13 +0000 (17:01 +0800)]
video: fbdev: controlfb: Fix COMPILE_TEST build

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 567e44fb51b4f909ae58038a7301352eecea8426 ]

If PPC_BOOK3S, PPC_PMAC and PPC32 is n, COMPILE_TEST build fails:

drivers/video/fbdev/controlfb.c:70:0: error: "pgprot_cached_wthru" redefined [-Werror]
 #define pgprot_cached_wthru(prot) (prot)

In file included from ./arch/powerpc/include/asm/pgtable.h:20:0,
                 from ./include/linux/pgtable.h:6,
                 from ./include/linux/mm.h:33,
                 from drivers/video/fbdev/controlfb.c:37:
./arch/powerpc/include/asm/nohash/pgtable.h:243:0: note: this is the location of the previous definition
 #define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \

Fixes: a07a63b0e24d ("video: fbdev: controlfb: add COMPILE_TEST support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 24cfeb466146ed325d08e1e27fab601ac94078fc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovideo: fbdev: matroxfb: set maxvram of vbG200eW to the same as vbG200 to avoid black...
Z. Liu [Sat, 18 Dec 2021 18:00:35 +0000 (02:00 +0800)]
video: fbdev: matroxfb: set maxvram of vbG200eW to the same as vbG200 to avoid black screen

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 62d89a7d49afe46e6b9bbe9e23b004ad848dbde4 ]

Start from commit 11be60bd66d54 "matroxfb: add Matrox MGA-G200eW board
support", when maxvram is 0x800000, monitor become black w/ error message
said: "The current input timing is not supported by the monitor display.
Please change your input timing to 1920x1080@60Hz ...".

Fixes: 11be60bd66d5 ("matroxfb: add Matrox MGA-G200eW board support")
Signed-off-by: Z. Liu <liuzx@knownsec.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 02684dd833327ebe7abb995dbd8c8d904c83bc3a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: aspeed: Correct value for h-total-pixels
Jammy Huang [Tue, 25 Jan 2022 06:44:07 +0000 (07:44 +0100)]
media: aspeed: Correct value for h-total-pixels

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4b732a0016853eaff35944f900b0db66f3914374 ]

Previous reg-field, 0x98[11:0], stands for the period of the detected
hsync signal.
Use the correct reg, 0xa0, to get h-total in pixels.

Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
Signed-off-by: Jammy Huang <jammy_huang@aspeedtech.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 96eb48f017cd3c6b53c6558f5c39c6f5c5c7c271)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: ov5648: Don't pack controls struct
Sakari Ailus [Mon, 10 Jan 2022 16:16:51 +0000 (17:16 +0100)]
media: ov5648: Don't pack controls struct

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit edd4fbff5378a8103470304809195dc8f4b1d42a ]

Don't pack the driver specific struct containing control pointers. This
lead to potential alignment issues when working with the pointers.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: e43ccb0a045f ("media: i2c: Add support for the OV5648 image sensor")
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4a305197732718979c8b575a166e802054c27964)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: v4l: Avoid unaligned access warnings when printing 4cc modifiers
Sakari Ailus [Mon, 10 Jan 2022 14:53:12 +0000 (15:53 +0100)]
media: v4l: Avoid unaligned access warnings when printing 4cc modifiers

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 24bb30c8c894ec7213ad810b46e2a6a4c12136c1 ]

Pointers V4L2 pixelformat and dataformat fields in a few packed structs
are directly passed to printk family of functions. This could result in an
unaligned access albeit no such possibility appears to exist at the
moment i.e. this clang warning appears to be a false positive.

Address the warning by copying the pixelformat or dataformat value to a
local variable first.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: e927e1e0f0dd ("v4l: ioctl: Use %p4cc printk modifier to print FourCC codes")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 26b1865f1fd4beaa84ca6e78c1b73def7d3fc01a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: ov6650: Fix set format try processing path
Janusz Krzysztofik [Sun, 3 May 2020 22:06:16 +0000 (00:06 +0200)]
media: ov6650: Fix set format try processing path

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1f6f1e959a85ee999fbc86f4b094827f63194c7f ]

According to subdevice interface specification found in V4L2 API
documentation, set format pad operations should not affect image
geometry set in preceding image processing steps. Unfortunately, that
requirement is not respected by the driver implementation of set format
as it was not the case when that code was still implementing a pair of
now obsolete .s_mbus_fmt() / .try_mbus_fmt() video operations before
they have been merged and reused as an implementation of .set_fmt() pad
operation by commit 717fd5b4907a ("[media] v4l2: replace try_mbus_fmt
by set_fmt").

In case of set format active processing path the issue can be fixed
easily by excluding a call to set active selection from that path. That
will effectively limit frame size processing to optimal frame scaling
against active crop rectangle without touching it.  Users can just call
set active selection themselves to obtain desired frame size.  However,
set format try processing path needs more work.

First of all, the driver should be extended with set try selection
support.  Lack of it constraints video device drivers to not use
subdevice cropping at all while processing user requested active frame
size, otherwise their set try format results might differ from active.

Next, set format try processing path should use pad config crop
rectangle as a reference, not the active one as it does now.  That
issue can be resolved easily as soon as set try selection support is
added to the driver so pad config crop rectangle can be maintained by
users via selection API.

Last, set format try processing path should give the same results as
active in respect to active vs. pad config crop rectangle geometry.
Both rectangles should be either not touched by set format (that's what
we are going to achieve) or modified the same way, otherwise users
won't be able to obtain equal results from both paths while iterating
through set format and set selection operations in order to obtain
desired frame size.

We can't begin with modifying set format pad operation as not to touch
crop rectangle since that depends on availability of set try selection
for symmetry.  Neither can we begin with adding set try selection since
that in turn depends on equal handling of active and pad config crop
rectangles by set format.  We can either implement all required
modifications in a single patch, or begin with fixing current set
format try processing path to appropriately handle pad config crop
rectangle.  This patch implements the latter approach as believed to
be more readable.

Move crop rectangle adjustments code from a helper (the former
implementation of .s_fmt(), now called from set format active
processing path) to the body of set format pad operation function
where it can be also used for processing try requests for symmetry with
active ones.  As the helper no longer processes frame geometry, only
frame format and half scaling, simplify its API accordingly and update
its users.

Moreover, extract code that applies crop rectangle hardware limits
(now a part of .set_selection() operation which is called from set
format active processing path) to a new helper and call that helper
from set format try processing path as well for symmetry with active.

[Sakari Ailus: Rebase on subdev state patches]

Fixes: 717fd5b4907a ("[media] v4l2: replace try_mbus_fmt by set_fmt")
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ef35afc268c5e0f892e1f717ff19678877287ac9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: hantro: Fix overfill bottom register field name
Chen-Yu Tsai [Fri, 7 Jan 2022 09:34:49 +0000 (10:34 +0100)]
media: hantro: Fix overfill bottom register field name

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 89d78e0133e71ba324fb67ca776223fba4353418 ]

The Hantro H1 hardware can crop off pixels from the right and bottom of
the source frame. These are controlled with the H1_REG_IN_IMG_CTRL_OVRFLB
and H1_REG_IN_IMG_CTRL_OVRFLR in the H1_REG_IN_IMG_CTRL register.

The ChromeOS kernel driver that this was based on incorrectly added the
_D4 suffix H1_REG_IN_IMG_CTRL_OVRFLB. This field crops the bottom of the
input frame, and the number is _not_ divided by 4. [1]

Correct the name to avoid confusion when crop support with the selection
API is added.

[1] https://chromium.googlesource.com/chromiumos/third_party/kernel/+/refs/ \
heads/chromeos-4.19/drivers/staging/media/hantro/hantro_h1_vp8_enc.c#377

Fixes: 775fec69008d ("media: add Rockchip VPU JPEG encoder driver")
Fixes: a29add8c9bb2 ("media: rockchip/vpu: rename from rockchip to hantro")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4ea548312052a3361dd4038bbfd223119bc416dc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: meson: vdec: potential dereference of null pointer
Jiasheng Jiang [Thu, 13 Jan 2022 06:59:28 +0000 (07:59 +0100)]
media: meson: vdec: potential dereference of null pointer

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c8c80c996182239ff9b05eda4db50184cf3b2e99 ]

As the possible failure of the kzalloc(), the 'new_ts' could be NULL
pointer.
Therefore, it should be better to check it in order to avoid the
dereference of the NULL pointer.
Also, the caller esparser_queue() needs to deal with the return value of
the amvdec_add_ts().

Fixes: 876f123b8956 ("media: meson: vdec: bring up to compliance")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Suggested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b0b890dd8df3b9a2fe726826980b1cffe17b9679)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: coda: Fix missing put_device() call in coda_get_vdoa_data
Miaoqian Lin [Wed, 12 Jan 2022 11:05:54 +0000 (12:05 +0100)]
media: coda: Fix missing put_device() call in coda_get_vdoa_data

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ca85d271531a1e1c86f24b892f57b7d0a3ddb5a6 ]

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes: e7f3c5481035 ("[media] coda: use VDOA for un-tiling custom macroblock format")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c3590ec1161d2178bfba0155bb0dc2d29dffbc4e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: simple-card-utils: Set sysclk on all components
Robert Hancock [Thu, 20 Jan 2022 19:58:30 +0000 (13:58 -0600)]
ASoC: simple-card-utils: Set sysclk on all components

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ce2f7b8d4290c22e462e465d1da38a1c113ae66a ]

If an mclk-fs value was provided in the device tree configuration, the
calculated MCLK was fed into the downstream codec DAI and CPU DAI,
however set_sysclk was not being called on the platform device. Some
platform devices such as the Xilinx Audio Formatter need to know the MCLK
as well.

Call snd_soc_component_set_sysclk on each component in the stream to set
the proper sysclk value in addition to the existing call of
snd_soc_dai_set_sysclk on the codec DAI and CPU DAI. This may end up
resulting in redundant calls if one of the snd_soc_dai_set_sysclk calls
ends up calling snd_soc_component_set_sysclk itself, but that isn't
expected to cause any significant harm.

Fixes: f48dcbb6d47d ("ASoC: simple-card-utils: share asoc_simple_hw_param()")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20220120195832.1742271-5-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f0344f0aee4dd74f109014d955f1b7da725511b5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: xilinx: xlnx_formatter_pcm: Handle sysclk setting
Robert Hancock [Thu, 20 Jan 2022 19:58:27 +0000 (13:58 -0600)]
ASoC: xilinx: xlnx_formatter_pcm: Handle sysclk setting

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1c5091fbe7e0d0804158200b7feac5123f7b4fbd ]

This driver did not set the MM2S Fs Multiplier Register to the proper
value for playback streams. This needs to be set to the sample rate to
MCLK multiplier, or random stream underflows can occur on the downstream
I2S transmitter.

Store the sysclk value provided via the set_sysclk callback and use that
in conjunction with the sample rate in the hw_params callback to calculate
the proper value to set for this register.

Fixes: 6f6c3c36f091 ("ASoC: xlnx: add pcm formatter platform driver")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Link: https://lore.kernel.org/r/20220120195832.1742271-2-robert.hancock@calian.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit bb0a0e23dd0070e6f407387f3822daef95e5815d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: codecs: Check for error pointer after calling devm_regmap_init_mmio
Jiasheng Jiang [Fri, 21 Jan 2022 17:10:31 +0000 (01:10 +0800)]
ASoC: codecs: Check for error pointer after calling devm_regmap_init_mmio

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit aa505ecccf2ae7546e0e262d574e18a9241f3005 ]

Since the potential failure of the devm_regmap_init_mmio(), it will
return error pointer and be assigned to the regmap.
Then the error pointer will be dereferenced.
For example rx->regmap will be used in rx_macro_mclk_enable().
Therefore, it should be better to check it.

Fixes: af3d54b99764 ("ASoC: codecs: lpass-rx-macro: add support for lpass rx macro")
Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro")
Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220121171031.2826198-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1179081ba5fa561f45f489b2682e49c5a4b56e8e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoASoC: sh: rz-ssi: Drop calling rz_ssi_pio_recv() recursively
Lad Prabhakar [Mon, 10 Jan 2022 09:47:07 +0000 (09:47 +0000)]
ASoC: sh: rz-ssi: Drop calling rz_ssi_pio_recv() recursively

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6570f991582e32b7992601d0497c61962a2c5dcc ]

Instead of recursively calling rz_ssi_pio_recv() use a while loop
to read the samples from RX fifo.

This also fixes an issue where the return value of rz_ssi_pio_recv()
was ignored when called recursively.

Fixes: 03e786bd4341 ("ASoC: sh: Add RZ/G2L SSIF-2 driver")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20220110094711.8574-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e48b189799d3e39cd94453eabb22b0c49f31107c)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: atmel: atmel-sama7g5-isc: fix ispck leftover
Eugen Hristev [Mon, 13 Dec 2021 13:49:23 +0000 (14:49 +0100)]
media: atmel: atmel-sama7g5-isc: fix ispck leftover

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1b52ce99e9f2dcda868a1a7026bfb58d04bd6bc8 ]

The ispck is not used for sama7g5 variant of the ISC.
Calls to ispck have to be removed also from module insert/removal.

Fixes: d7f26849ed7c ("media: atmel: fix the ispck initialization")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f7d07ad8bc03511fdff8a647f1767e2800dd8ad0)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: bttv: fix WARNING regression on tunerless devices
Ondrej Zary [Sat, 25 Dec 2021 21:58:44 +0000 (22:58 +0100)]
media: bttv: fix WARNING regression on tunerless devices

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ef058cc8b7193d15a771272359c7454839ae74ee ]

Commit 2161536516ed ("media: media/pci: set device_caps in struct video_device")
introduced a regression: V4L2_CAP_TUNER is always present in device_caps,
even when the device has no tuner.

This causes a warning:
WARNING: CPU: 0 PID: 249 at drivers/media/v4l2-core/v4l2-ioctl.c:1102 v4l_querycap+0xa0/0xb0 [videodev]

Fixes: 2161536516ed ("media: media/pci: set device_caps in struct video_device")
Signed-off-by: Ondrej Zary <linux@zary.sk>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 25b925f94a36aeeab5270546bf5fb7ee37cefe44)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: imx: imx8mq-mipi_csi2: fix system resume
Martin Kepplinger [Thu, 16 Dec 2021 09:03:36 +0000 (10:03 +0100)]
media: imx: imx8mq-mipi_csi2: fix system resume

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f0c2ba1ed4ad868331d8c6ea9119669a729b01a9 ]

during system resume, interconnect bandwidth would currently be requested
even though the device is runtime suspended. This leaves the system in an
unbalanced state.

Fix that by only doing that in runtimem pm and splitting up runtime and
system suspend to be a more readable:
imx8mq_mipi_csi_pm_*() does the generic things called from system- and
runtime functions that each do specific things on top.

Fixes: f33fd8d77dd0 ("media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller")
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e1854a6c3a68deb185d9c90d32f7ad495518e577)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: imx: imx8mq-mipi-csi2: remove wrong irq config write operation
Martin Kepplinger [Thu, 16 Dec 2021 09:03:35 +0000 (10:03 +0100)]
media: imx: imx8mq-mipi-csi2: remove wrong irq config write operation

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 59c2b6d51803ad6b7af28f2a60a843b24374e692 ]

The place where this register writel() that masks one interrupt is placed
does not guarantee that the device is powered so that's not allowed.
Moreover imx8mq_mipi_csi_start_stream() masks the interrupt anyway so the
write is not even needed. Remove it as this is a mistake that slipped in
with the driver.

Fixes: f33fd8d77dd0 ("media: imx: add a driver for i.MX8MQ mipi csi rx phy and controller")
Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 72d79cd3c3ad04b8fc67f4d34db7624f1193d495)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: mtk-vcodec: potential dereference of null pointer
Jiasheng Jiang [Wed, 15 Dec 2021 05:21:57 +0000 (06:21 +0100)]
media: mtk-vcodec: potential dereference of null pointer

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit e25a89f743b18c029bfbe5e1663ae0c7190912b0 ]

The return value of devm_kzalloc() needs to be checked.
To avoid use of null pointer in case of thefailure of alloc.

Fixes: 46233e91fa24 ("media: mtk-vcodec: move firmware implementations into their own files")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0022dc8cafa5fcd156da8ae7bfc9ca99497bdffc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls
Chen-Yu Tsai [Thu, 9 Dec 2021 16:38:03 +0000 (17:38 +0100)]
media: v4l2-mem2mem: Apply DST_QUEUE_OFF_BASE on MMAP buffers across ioctls

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8310ca94075e784bbb06593cd6c068ee6b6e4ca6 ]

DST_QUEUE_OFF_BASE is applied to offset/mem_offset on MMAP capture buffers
only for the VIDIOC_QUERYBUF ioctl, while the userspace fields (including
offset/mem_offset) are filled in for VIDIOC_{QUERY,PREPARE,Q,DQ}BUF
ioctls. This leads to differences in the values presented to userspace.
If userspace attempts to mmap the capture buffer directly using values
from DQBUF, it will fail.

Move the code that applies the magic offset into a helper, and call
that helper from all four ioctl entry points.

[hverkuil: drop unnecessary '= 0' in v4l2_m2m_querybuf() for ret]

Fixes: 7f98639def42 ("V4L/DVB: add memory-to-memory device helper framework for videobuf")
Fixes: 908a0d7c588e ("[media] v4l: mem2mem: port to videobuf2")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 48d00e24822e4384edcee3aae03d54c1b7982eba)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomedia: staging: media: imx: imx7-mipi-csis: Make subdev name unique
Laurent Pinchart [Fri, 25 Jun 2021 02:26:35 +0000 (04:26 +0200)]
media: staging: media: imx: imx7-mipi-csis: Make subdev name unique

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5be7f8c91d25089be847a71b336c13b5bb0db772 ]

When multiple CSIS instances are present in a single graph, they are
currently all named "imx7-mipi-csis.0", which breaks the entity name
uniqueness requirement. Fix it by using the device name to create the
subdev name.

Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com> # On i.MX8MP
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1fbc023f8173910baeb7fd521567bfdd177dd0e9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>