Unused variable warning while using a pointer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divyaplayhard
    New Member
    • Dec 2014
    • 1

    Unused variable warning while using a pointer

    void lock_fun( void *dev)
    {
    os_dev *osdev = (os_dev *)dev;
    SPIN_LOCK(&osde v->tx_lock);
    return;
    }

    Here I am getting a warning - unused variable osdev. The variable is being used but still I am getting the warning. Can someone please help me out with the same?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    This looks odd:

    Code:
    SPIN_LOCK[B](&osdev->tx[/B]_lock);
    osdev is a pointer. Do you mean: &(osdev-tx) ? That would be he address of the tx member of osdev. Assuming of course the typecast works.

    &osdev->tx would be the address of osdev so you aren't really using osdev itself.

    I don't see any prototypes ere so I don't know what these functions are expecting.

    Comment

    Working...