diff mbox series

iBluetooth: hci_intel: Add check for platform_driver_register

Message ID 20220531033228.1939386-1-jiasheng@iscas.ac.cn
State Accepted
Commit 822e1b3ca0fbb495bf2d316ca8e7d5eccc77577a
Headers show
Series iBluetooth: hci_intel: Add check for platform_driver_register | expand

Commit Message

Jiasheng Jiang May 31, 2022, 3:32 a.m. UTC
As platform_driver_register() could fail, it should be better
to deal with the return value in order to maintain the code
consisitency.

Fixes: 1ab1f239bf17 ("Bluetooth: hci_intel: Add support for platform driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/bluetooth/hci_intel.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Marcel Holtmann June 2, 2022, 3:40 p.m. UTC | #1
Hi Jiasheng,

> As platform_driver_register() could fail, it should be better
> to deal with the return value in order to maintain the code
> consisitency.
> 
> Fixes: 1ab1f239bf17 ("Bluetooth: hci_intel: Add support for platform driver")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/bluetooth/hci_intel.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
> index 7249b91d9b91..d4801b26cc8e 100644
> --- a/drivers/bluetooth/hci_intel.c
> +++ b/drivers/bluetooth/hci_intel.c
> @@ -1217,7 +1217,11 @@ static struct platform_driver intel_driver = {
> 
> int __init intel_init(void)
> {
> -	platform_driver_register(&intel_driver);
> +	int ret;
> +
> +	ret = platform_driver_register(&intel_driver);
> +	if (ret)
> +		return ret;

most of the driver uses int err. So please do that as well.

Regards

Marcel
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c
index 7249b91d9b91..d4801b26cc8e 100644
--- a/drivers/bluetooth/hci_intel.c
+++ b/drivers/bluetooth/hci_intel.c
@@ -1217,7 +1217,11 @@  static struct platform_driver intel_driver = {
 
 int __init intel_init(void)
 {
-	platform_driver_register(&intel_driver);
+	int ret;
+
+	ret = platform_driver_register(&intel_driver);
+	if (ret)
+		return ret;
 
 	return hci_uart_register_proto(&intel_proto);
 }