diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2022-04-22 09:48:18 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-14 19:32:31 +0300 |
commit | f9782b26d6f1134923d7232c82f06999ad0a09c7 (patch) | |
tree | be9e85251b4615bb739e919c09bb5e177813cf8c /drivers/staging | |
parent | b382c0c3b8cc33465f23827f9f21218a0d8ad0cf (diff) | |
download | linux-f9782b26d6f1134923d7232c82f06999ad0a09c7.tar.xz |
staging: fieldbus: Fix the error handling path in anybuss_host_common_probe()
[ Upstream commit 7079b3483a17be2cfba64cbd4feb1b7ae07f1ea7 ]
If device_register() fails, device_unregister() should not be called
because it will free some resources that are not allocated.
put_device() should be used instead.
Fixes: 308ee87a2f1e ("staging: fieldbus: anybus-s: support HMS Anybus-S bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5401a519608d6e1a4e7435c20f4f20b0c5c36c23.1650610082.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/fieldbus/anybuss/host.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/fieldbus/anybuss/host.c b/drivers/staging/fieldbus/anybuss/host.c index 549cb7d51af8..2a20a1767d77 100644 --- a/drivers/staging/fieldbus/anybuss/host.c +++ b/drivers/staging/fieldbus/anybuss/host.c @@ -1384,7 +1384,7 @@ anybuss_host_common_probe(struct device *dev, goto err_device; return cd; err_device: - device_unregister(&cd->client->dev); + put_device(&cd->client->dev); err_kthread: kthread_stop(cd->qthread); err_reset: |