@@ -1173,16 +1173,6 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)
1173
1173
goto out ;
1174
1174
}
1175
1175
1176
- /*
1177
- * In sysFS mode we can have multiple writers per sink. Since this
1178
- * sink is already enabled no memory is needed and the HW need not be
1179
- * touched, even if the buffer size has changed.
1180
- */
1181
- if (drvdata -> mode == CS_MODE_SYSFS ) {
1182
- atomic_inc (& csdev -> refcnt );
1183
- goto out ;
1184
- }
1185
-
1186
1176
/*
1187
1177
* If we don't have a buffer or it doesn't match the requested size,
1188
1178
* use the buffer allocated above. Otherwise reuse the existing buffer.
@@ -1204,7 +1194,7 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev)
1204
1194
1205
1195
static int tmc_enable_etr_sink_sysfs (struct coresight_device * csdev )
1206
1196
{
1207
- int ret ;
1197
+ int ret = 0 ;
1208
1198
unsigned long flags ;
1209
1199
struct tmc_drvdata * drvdata = dev_get_drvdata (csdev -> dev .parent );
1210
1200
struct etr_buf * sysfs_buf = tmc_etr_get_sysfs_buffer (csdev );
@@ -1213,12 +1203,24 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
1213
1203
return PTR_ERR (sysfs_buf );
1214
1204
1215
1205
spin_lock_irqsave (& drvdata -> spinlock , flags );
1206
+
1207
+ /*
1208
+ * In sysFS mode we can have multiple writers per sink. Since this
1209
+ * sink is already enabled no memory is needed and the HW need not be
1210
+ * touched, even if the buffer size has changed.
1211
+ */
1212
+ if (drvdata -> mode == CS_MODE_SYSFS ) {
1213
+ atomic_inc (& csdev -> refcnt );
1214
+ goto out ;
1215
+ }
1216
+
1216
1217
ret = tmc_etr_enable_hw (drvdata , sysfs_buf );
1217
1218
if (!ret ) {
1218
1219
drvdata -> mode = CS_MODE_SYSFS ;
1219
1220
atomic_inc (& csdev -> refcnt );
1220
1221
}
1221
1222
1223
+ out :
1222
1224
spin_unlock_irqrestore (& drvdata -> spinlock , flags );
1223
1225
1224
1226
if (!ret )
0 commit comments