]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mfd: davinci_voicecodec: Fix possible null-ptr-deref davinci_vc_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 26 Apr 2022 03:08:57 +0000 (11:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:26:10 +0000 (10:26 +0200)
commit2d00158a06efe6bbcd020108634ea0f2ed8b32f7
tree0bfd29fd20a1bca077d0955cc61d5e762cc42f9e
parent8bf1185d75c8b6c3fd7b2b63d18d9dd096235cb5
mfd: davinci_voicecodec: Fix possible null-ptr-deref davinci_vc_probe()

[ Upstream commit 311242c7703df0da14c206260b7e855f69cb0264 ]

It will cause null-ptr-deref when using 'res', if platform_get_resource()
returns NULL, so move using 'res' after devm_ioremap_resource() that
will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.

Fixes: b5e29aa880be ("mfd: davinci_voicecodec: Remove pointless #include")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220426030857.3539336-1-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/davinci_voicecodec.c