From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 002CF286417; Mon, 23 Mar 2026 14:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275313; cv=none; b=Dvmtj082NA+KxwbmKNv3Z/aUI325/R+OWyzJbJlSAUMEIRZ0hkVoQuqhrJJvpy9zXOl67h1wLY/rUe7WLvATT73lznSUCMb+n8L24exChOPl4jgdsjHMr5KHpXyDgOnvBk4pzUjyjvtKXhaofXAO5rnxwi810rKql2buISvJLIQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275313; c=relaxed/simple; bh=xDclFiW0tqejs61CGTxKdMFQzKu2DYVgm9Eie9Df7Vs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=frLYYaAXO2DAtyM4OcFXxa8o4DRZi9Umhn0Ji4WR2v4ATXxNDTlpX5GLW7nUiSa1LE6gppHnvdwKeZPoqQGj0Wna2h5lEQ+0PZVCjb4k5Lla9YCLT0mWamnvRiyYWR1qN6CRjpTUT9IYa6R/GHIZ13AviR+g/w2WW9LV6ZuFygQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Bgf2NbLq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Bgf2NbLq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88650C4CEF7; Mon, 23 Mar 2026 14:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774275312; bh=xDclFiW0tqejs61CGTxKdMFQzKu2DYVgm9Eie9Df7Vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bgf2NbLqIdcYGTmdAGcybQqYi0I1c8rypA1jgpzrhuSS5OKml8Bx7s3Ol6qYHcjz1 hdIrua8JVxMBXohLlT8n7Lj7SDEJdJP8d0nGWPkTyAao2pa9Eado+oPoWdwij3hwVl 787557mlz50GH6Bos5SHhCW8Ec+vQEPJqZ8DAjDY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wenyuan Li <2063309626@qq.com>, Marc Kleine-Budde , Sasha Levin Subject: [PATCH 6.12 050/460] can: hi311x: hi3110_open(): add check for hi3110_power_enable() return value Date: Mon, 23 Mar 2026 14:40:46 +0100 Message-ID: <20260323134527.939179862@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wenyuan Li <2063309626@qq.com> [ Upstream commit 47bba09b14fa21712398febf36cb14fd4fc3bded ] In hi3110_open(), the return value of hi3110_power_enable() is not checked. If power enable fails, the device may not function correctly, while the driver still returns success. Add a check for the return value and propagate the error accordingly. Signed-off-by: Wenyuan Li <2063309626@qq.com> Link: https://patch.msgid.link/tencent_B5E2E7528BB28AA8A2A56E16C49BD58B8B07@qq.com Fixes: 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver") [mkl: adjust subject, commit message and jump label] Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/spi/hi311x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index c9eba1d37b0eb..10470e7436158 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -756,7 +756,9 @@ static int hi3110_open(struct net_device *net) return ret; mutex_lock(&priv->hi3110_lock); - hi3110_power_enable(priv->transceiver, 1); + ret = hi3110_power_enable(priv->transceiver, 1); + if (ret) + goto out_close_candev; priv->force_quit = 0; priv->tx_skb = NULL; @@ -791,6 +793,7 @@ static int hi3110_open(struct net_device *net) hi3110_hw_sleep(spi); out_close: hi3110_power_enable(priv->transceiver, 0); + out_close_candev: close_candev(net); mutex_unlock(&priv->hi3110_lock); return ret; -- 2.51.0