]> git.ipfire.org Git - thirdparty/linux.git/commit
can: mcp251x: add error handling for power enable in open and resume
authorWenyuan Li <2063309626@qq.com>
Sun, 15 Mar 2026 16:00:22 +0000 (00:00 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 19 Mar 2026 13:25:04 +0000 (14:25 +0100)
commit7a57354756c7df223abe2c33774235ad70cb4231
treef4ac51ed8569a41782b41906de39cd51454a6796
parentcadf6019231b614ebbd9ec2a16e5997ecbd8d016
can: mcp251x: add error handling for power enable in open and resume

Add missing error handling for mcp251x_power_enable() calls in both
mcp251x_open() and mcp251x_can_resume() functions.

In mcp251x_open(), if power enable fails, jump to error path to close
candev without attempting to disable power again.

In mcp251x_can_resume(), properly check return values of power enable calls
for both power and transceiver regulators. If any fails, return the error
code to the PM framework and log the failure.

This ensures the driver properly handles power control failures and
maintains correct device state.

Signed-off-by: Wenyuan Li <2063309626@qq.com>
Link: https://patch.msgid.link/tencent_F3EFC5D7738AC548857B91657715E2D3AA06@qq.com
[mkl: fix patch description]
[mkl: mcp251x_can_resume(): replace goto by return]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251x.c