Identifying the code from a warning in the kernel log

2.6k views Asked by At

while booting my linux kernel I am getting the log file like this what causing this and how to solve..?

------------[ cut here ]------------
WARNING: at drivers/gpio/gpiolib.c:1423 0xa02147ab()
Modules linked in:
Backtrace: no frame pointer
 ---[ end trace ccc3de96c2b87179 ]---
------------[ cut here ]------------
WARNING: at drivers/gpio/gpiolib.c:1423 0xa02147ab()
Modules linked in:
Backtrace: no frame pointer
---[ end trace ccc3de96c2b8717a ]---
------------[ cut here ]------------
WARNING: at drivers/gpio/gpiolib.c:1423 0xa02147ab()
Modules linked in:
Backtrace: no frame pointer
---[ end trace ccc3de96c2b8717b ]---
ds3232 0-0068: rtc core: registered ds3232 as rtc0
i2c-gpio i2c-gpio.0: using pins 27 (SDA) and 28 (SCL)
1

There are 1 answers

9
TheCodeArtist On

Pay close attention to the following line in the kernel log :
WARNING: at drivers/gpio/gpiolib.c:1423 0xa02147ab()

This means that this print is triggered from line number 1423 of the file drivers/gpio/gpiolib.c


WARN_ON() triggered from drivers/gpio/gpiolib.c:1423 in the Linux Kernel.

int __gpio_get_value(unsigned gpio)
{
        struct gpio_chip        *chip;

        chip = gpio_to_chip(gpio);
        WARN_ON(extra_checks && chip->can_sleep);
        return chip->get ? chip->get(chip, gpio - chip->base) : 0;
}

NOTE : The above code is (v2.6.33 on arch=x86). Before proceeding with the above analysis, confirm that you are indeed running Linux Kernel v2.6.33 on x86 hardware. Line numbers change with kernel versions. You may have co-incidentally hit upon a WARN_ON() in a different function on the same line in a different kernel version.


Update :

Since this issue is caused while communicating with the RTC-DS3232 peripheral (which is otherwise working fine) we can disable the warnings.

One way to do this is to disable CONFIG_DEBUG in the Linux kernel build configuration. This in turn disables extra_checks within the gpio driver.

Alternately one can override the definition of extra_checks at drivers/gpio/gpiolib.c:34 as follows

/* When debugging, extend minimal trust to callers and platform code.
 * Also emit diagnostic messages that may help initial bringup, when
 * board setup or driver bugs are most common.
 *
 * Otherwise, minimize overhead in what may be bitbanging codepaths.
 */
#ifdef  DEBUG
#define extra_checks    1
#else
#define extra_checks    0
#endif

/* override extra_checks irrespective of debug-mode */
#define extra_checks    0