AnsweredAssumed Answered

Potential problem in linux/drivers/char/bfin_sport.c.

Question asked by karak on Apr 2, 2016
Latest reply on Apr 6, 2016 by Aaronwu

If enable debug, struct sport_dev *dev will be used before it can be setting up properly value:

 

diff --git a/drivers/char/bfin_sport.c b/drivers/char/bfin_sport.c

index 489355f..c9d002c 100644

--- a/drivers/char/bfin_sport.c

+++ b/drivers/char/bfin_sport.c

@@ -347,8 +347,6 @@ static int sport_open(struct inode *inode, struct file *filp)

        int minor;

        struct sport_dev *dev;

 

-       dev_dbg(dev->dev, "%s enter\n", __func__);

-

        minor = MINOR(inode->i_rdev);

        list_for_each_entry(dev, &sport_list, list)

                if (dev->misc.minor == minor) {

@@ -356,6 +354,8 @@ static int sport_open(struct inode *inode, struct file *filp)

                        break;

                }

 

+       dev_dbg(dev->dev, "%s enter\n", __func__);

+

        mutex_init(&dev->mutex);

 

        if (mutex_lock_interruptible(&dev->mutex))

Outcomes