mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
ASoC: soc-topology-test: Check return value of kunit_device_register()
Call to kunit_device_register() can fail. Check return result of
register call. While at it introduce helper variable so that if it fails
put_device is called on properly initialized variable.
Fixes: e57cdff0dd ("ASoC: topology: Replace fake root_device with kunit_device in tests")
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Link: https://patch.msgid.link/20261014200608.118770-4-amade@asmblr.net
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
223ec2a93b
commit
1641c1ba27
|
|
@ -24,8 +24,12 @@ static struct device *test_dev;
|
|||
|
||||
static int snd_soc_tplg_test_init(struct kunit *test)
|
||||
{
|
||||
test_dev = kunit_device_register(test, "sound-soc-topology-test");
|
||||
test_dev = get_device(test_dev);
|
||||
struct device *dev;
|
||||
|
||||
dev = kunit_device_register(test, "sound-soc-topology-test");
|
||||
if (IS_ERR(dev))
|
||||
return PTR_ERR(dev);
|
||||
test_dev = get_device(dev);
|
||||
if (!test_dev)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user