@@ -98,6 +98,12 @@ EXPORT_SYMBOL_GPL(lpit_read_residency_count_address);
98
98
static void lpit_update_residency (struct lpit_residency_info * info ,
99
99
struct acpi_lpit_native * lpit_native )
100
100
{
101
+ struct device * dev_root = bus_get_dev_root (& cpu_subsys );
102
+
103
+ /* Silently fail, if cpuidle attribute group is not present */
104
+ if (!dev_root )
105
+ return ;
106
+
101
107
info -> frequency = lpit_native -> counter_frequency ?
102
108
lpit_native -> counter_frequency : tsc_khz * 1000 ;
103
109
if (!info -> frequency )
@@ -108,18 +114,18 @@ static void lpit_update_residency(struct lpit_residency_info *info,
108
114
info -> iomem_addr = ioremap (info -> gaddr .address ,
109
115
info -> gaddr .bit_width / 8 );
110
116
if (!info -> iomem_addr )
111
- return ;
117
+ goto exit ;
112
118
113
- /* Silently fail, if cpuidle attribute group is not present */
114
- sysfs_add_file_to_group (& cpu_subsys .dev_root -> kobj ,
119
+ sysfs_add_file_to_group (& dev_root -> kobj ,
115
120
& dev_attr_low_power_idle_system_residency_us .attr ,
116
121
"cpuidle" );
117
122
} else if (info -> gaddr .space_id == ACPI_ADR_SPACE_FIXED_HARDWARE ) {
118
- /* Silently fail, if cpuidle attribute group is not present */
119
- sysfs_add_file_to_group (& cpu_subsys .dev_root -> kobj ,
123
+ sysfs_add_file_to_group (& dev_root -> kobj ,
120
124
& dev_attr_low_power_idle_cpu_residency_us .attr ,
121
125
"cpuidle" );
122
126
}
127
+ exit :
128
+ put_device (dev_root );
123
129
}
124
130
125
131
static void lpit_process (u64 begin , u64 end )
0 commit comments