drivers/staging/gasket: Use refcount_read()
authorTodd Poynor <toddpoynor@google.com>
Sat, 7 Jul 2018 06:43:10 +0000 (23:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Jul 2018 08:02:09 +0000 (10:02 +0200)
Use the refcount_read accessor function, avoid reaching into refcount
and atomic struct fields.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gasket/gasket_sysfs.c

index 40268fb50fc3b2dac7b59ca1837175dd105899d2..a3705d6e088a0f25a7239da8e94ebfd5a7ca5da5 100644 (file)
@@ -122,7 +122,7 @@ static void put_mapping(struct gasket_sysfs_mapping *mapping)
        }
 
        mutex_lock(&mapping->mutex);
-       if (mapping->refcount.refcount.refs.counter == 0)
+       if (refcount_read(&mapping->refcount.refcount) == 0)
                gasket_nodev_error("Refcount is already 0!");
        if (kref_put(&mapping->refcount, release_entry)) {
                gasket_nodev_info("Removing Gasket sysfs mapping, device %s",