Hi, Stefan Agner wrote: > Reported-by: Ashutosh Singh <[email protected]> > Suggested-by: Marc Kleine-Budde <[email protected]> > [[email protected]: added return check for clk_enable_prepare] > > Signed-off-by: Stefan Agner <[email protected]> > --- > drivers/net/can/flexcan.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c > index f425ec2..89745aa 100644 > --- a/drivers/net/can/flexcan.c > +++ b/drivers/net/can/flexcan.c > @@ -383,12 +383,26 @@ static int flexcan_get_berr_counter(const struct > net_device *dev, > { > const struct flexcan_priv *priv = netdev_priv(dev); > struct flexcan_regs __iomem *regs = priv->base; > - u32 reg = flexcan_read(®s->ecr); > + u32 reg, err; > + > + err = clk_prepare_enable(priv->clk_ipg); > + if (err) > + return err; > + > + err = clk_prepare_enable(priv->clk_per); > + if (err) > + goto out_disable_ipg; > + > + reg = flexcan_read(®s->ecr); > flexcan_get_berr_counter() may be called from interrupt context and thus must not call any functions that can sleep. Compiling the driver with CONFIG_DEBUG_ATOMIC_SLEEP would catch this!
Lothar Waßmann -- ___________________________________________________________ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | [email protected] ___________________________________________________________ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

