Skip to contentSkip to conversation

platform/x86: toshiba_bluetooth: Use more common error handling code in toshiba_bt_rfkill_probe()

PATCH In review Markus Elfring 2 participants 2 messages Jun 17 – Jul 1

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: toshiba_bluetooth: Use more common error handling code in toshiba_bt_rfkill_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 17 Jun 2026 10:50:15 +0200

Use an existing label once more so that a bit of exception handling can be better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

---
 drivers/platform/x86/toshiba_bluetooth.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/platform/x86/toshiba_bluetooth.c +2 -4
index e00abba58c7c..bf199fba4999 100644
@@ -252,10 +252,8 @@ static int toshiba_bt_rfkill_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, bt_dev);
 
 	result = toshiba_bluetooth_sync_status(bt_dev);
-	if (result) {
-		kfree(bt_dev);
-		return result;
-	}
+	if (result)
+		goto err_free_bt_dev;
 
 	bt_dev->rfk = rfkill_alloc("Toshiba Bluetooth",
 				   &pdev->dev,
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 4 lines · Markus Elfring

Use an existing label once more so that a bit of exception handling can be better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.

FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent or clearly a regression fix.

The list of commits applied:
[1/1] platform/x86: toshiba_bluetooth: Use more common error handling code in toshiba_bt_rfkill_probe()

      commit: f3aaddb8a085eda92d4c9792e031ead8237f79aa

--
i.