From 392480bf3fcae170df69ba55d2aaf54c139c81d7 Mon Sep 17 00:00:00 2001 From: Todd Poynor Date: Fri, 6 Jul 2018 23:43:10 -0700 Subject: [PATCH] drivers/staging/gasket: Use refcount_read() Use the refcount_read accessor function, avoid reaching into refcount and atomic struct fields. Signed-off-by: Todd Poynor Signed-off-by: Greg Kroah-Hartman --- gasket_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gasket_sysfs.c b/gasket_sysfs.c index 40268fb..a3705d6 100644 --- a/gasket_sysfs.c +++ b/gasket_sysfs.c @@ -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",