• Stefan Agner's avatar
    can: mcp251x: fix resume when device is down · c951f54e
    Stefan Agner authored
    commit 25b401c1 upstream.
    
    If a valid power regulator or a dummy regulator is used (which
    happens to be the case when no regulator is specified), restart_work
    is queued no matter whether the device was running or not at suspend
    time. Since work queues get initialized in the ndo_open callback,
    resuming leads to a NULL pointer exception.
    
    Reverse exactly the steps executed at suspend time:
    - Enable the power regulator in any case
    - Enable the transceiver regulator if the device was running, even in
      case we have a power regulator
    - Queue restart_work only in case the device was running
    
    Fixes: bf66f373 ("can: mcp251x: Move to threaded interrupts instead of workqueues.")
    Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
    Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    c951f54e
mcp251x.c 32 KB