Skip to content

Commit

Permalink
staging: fieldbus: Fix the error handling path in anybuss_host_common…
Browse files Browse the repository at this point in the history
…_probe()

[ Upstream commit 7079b34 ]

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: 308ee87 ("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>
  • Loading branch information
tititiou36 authored and gregkh committed Jun 14, 2022
1 parent b382c0c commit f9782b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/fieldbus/anybuss/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f9782b2

Please sign in to comment.