@@ -88,8 +88,7 @@ static int getHealthValue(int argc, char **argv, struct command *cmd, struct plu
88
88
89
89
if (percent_used > 100 || percent_used < 0 ) {
90
90
printf ("0%%\n" );
91
- }
92
- else {
91
+ } else {
93
92
healthvalue = 100 - percent_used ;
94
93
printf ("%d%%\n" , healthvalue );
95
94
}
@@ -200,8 +199,7 @@ static int getPLPHealth(int argc, char **argv, struct command *cmd, struct plugi
200
199
if (result ) {
201
200
printf ("\nThis device is not support.\n" );
202
201
return -1 ;
203
- }
204
- else {
202
+ } else {
205
203
char modelName [40 ];
206
204
const char * model_str_byte ;
207
205
model_str_byte = format_char_array ((char * )modelName , sizeof (modelName ), dataID , sizeof (dataID ));
@@ -215,8 +213,7 @@ static int getPLPHealth(int argc, char **argv, struct command *cmd, struct plugi
215
213
if (txtPLPHealth >= 0 ) {
216
214
plpHealth_percentage = txtPLPHealth ;
217
215
printf ("Capacitor health for PLP: %d%%\n" , plpHealth_percentage );
218
- }
219
- else {
216
+ } else {
220
217
unsigned char data [512 ];
221
218
struct nvme_passthru_cmd nvmecmd ;
222
219
@@ -230,8 +227,7 @@ static int getPLPHealth(int argc, char **argv, struct command *cmd, struct plugi
230
227
if (result ) {
231
228
printf ("\nGet PLP Health Fail.\n" );
232
229
return PLP_ERROR_NO_MATCH ;
233
- }
234
- else {
230
+ } else {
235
231
int tDis = (int )(data [4 + 3 ] << 24 ) + (int )(data [4 + 2 ] << 16 ) + (int )(data [4 + 1 ] << 8 ) + (int )(data [4 ]);
236
232
int vDis1 = (int )(data [0 ]);
237
233
int vDis2 = (int )(data [1 ]);
@@ -240,19 +236,16 @@ static int getPLPHealth(int argc, char **argv, struct command *cmd, struct plugi
240
236
241
237
if (vDis1 - vDis2 != 0 ) {
242
238
normalHealth = (iDis * tDis ) / (vDis1 - vDis2 );
243
- }
244
- else {
239
+ } else {
245
240
normalHealth = 0 ;
246
241
}
247
242
if (normalHealth >= 0 ) {
248
243
if (fullValue - normalHealth >= 0 ) {
249
244
plpHealth_percentage = (normalHealth / fullValue ) * 100 ;
250
- }
251
- else {
245
+ } else {
252
246
plpHealth_percentage = 100 ;
253
247
}
254
- }
255
- else {
248
+ } else {
256
249
plpHealth_percentage = 0 ;
257
250
}
258
251
printf ("Capacitor health for PLP: %d%%\n" , plpHealth_percentage );
@@ -314,8 +307,7 @@ int readUsefulPLPValue(const char *device)
314
307
token = strtok (NULL , "#" );
315
308
ret = atoi (token );
316
309
return ret ;
317
- }
318
- else {
310
+ } else {
319
311
return PLP_ERROR_DATA_EXPIRED ;
320
312
}
321
313
}
@@ -355,8 +347,7 @@ void recordPLPValue(const char *device, int value, bool isReplace)
355
347
{
356
348
if (strncmp (str , device , strlen (device )) == 0 ) {
357
349
fprintf (fileout , "%s\n" , line );
358
- }
359
- else {
350
+ } else {
360
351
fprintf (fileout , "%s" , str );
361
352
}
362
353
}
@@ -365,12 +356,10 @@ void recordPLPValue(const char *device, int value, bool isReplace)
365
356
366
357
if (remove (logFilePath ) == 0 ) {
367
358
rename (tempFilePath , logFilePath );
368
- }
369
- else {
359
+ } else {
370
360
remove (tempFilePath );
371
361
}
372
- }
373
- else {
362
+ } else {
374
363
FILE * out = fopen (logFilePath , "a" );
375
364
if (out == NULL ) {
376
365
perror ("Error opening file" );
0 commit comments