Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69b3a13f authored by Ziyang Xuan's avatar Ziyang Xuan Committed by Greg Kroah-Hartman
Browse files

nfc: fix error handling of nfc_proto_register()



commit 0911ab31896f0e908540746414a77dd63912748d upstream.

When nfc proto id is using, nfc_proto_register() return -EBUSY error
code, but forgot to unregister proto. Fix it by adding proto_unregister()
in the error handling case.

Fixes: c7fe3b52 ("NFC: add NFC socket family")
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20211013034932.2833737-1-william.xuanziyang@huawei.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2731eaac
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -60,6 +60,9 @@ int nfc_proto_register(const struct nfc_protocol *nfc_proto)
		proto_tab[nfc_proto->id] = nfc_proto;
	write_unlock(&proto_tab_lock);

	if (rc)
		proto_unregister(nfc_proto->proto);

	return rc;
}
EXPORT_SYMBOL(nfc_proto_register);