From e7d8247fdacbefdfb2cd1a38381189389670398f Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Tue, 14 Jan 2025 10:56:08 +0800 Subject: [PATCH] usbwallet: check error returned by driver close (#18057) Although current two implementations(ledgerDriver, trezorDriver) of interface driver.Close do not actually return any error. Instead, they only return nil. But since the declaration of Close function returns error, it is better to check the returned error in case in future some new implementation of Close function returns error and we may forget to modify the function which invokes Close function at that time. --- accounts/usbwallet/wallet.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/accounts/usbwallet/wallet.go b/accounts/usbwallet/wallet.go index 1cbf7a75d7..99c5724fc7 100644 --- a/accounts/usbwallet/wallet.go +++ b/accounts/usbwallet/wallet.go @@ -274,9 +274,7 @@ func (w *wallet) close() error { w.device = nil w.accounts, w.paths = nil, nil - w.driver.Close() - - return nil + return w.driver.Close() } // Accounts implements accounts.Wallet, returning the list of accounts pinned to