@@ -2566,7 +2566,7 @@ ufshcd_wait_for_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
2566
2566
* @hba: per adapter instance
2567
2567
* @uic_cmd: UIC command
2568
2568
*
2569
- * Return: 0 only if success .
2569
+ * Return: 0 if successful; < 0 upon failure .
2570
2570
*/
2571
2571
static int
2572
2572
__ufshcd_send_uic_cmd (struct ufs_hba * hba , struct uic_command * uic_cmd )
@@ -3072,6 +3072,9 @@ static void ufshcd_setup_dev_cmd(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
3072
3072
hba -> dev_cmd .type = cmd_type ;
3073
3073
}
3074
3074
3075
+ /*
3076
+ * Return: 0 upon success; < 0 upon failure.
3077
+ */
3075
3078
static int ufshcd_compose_dev_cmd (struct ufs_hba * hba ,
3076
3079
struct ufshcd_lrb * lrbp , enum dev_cmd_type cmd_type , int tag )
3077
3080
{
@@ -3184,9 +3187,13 @@ ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
3184
3187
break ;
3185
3188
}
3186
3189
3190
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3187
3191
return err ;
3188
3192
}
3189
3193
3194
+ /*
3195
+ * Return: 0 upon success; < 0 upon failure.
3196
+ */
3190
3197
static int ufshcd_wait_for_dev_cmd (struct ufs_hba * hba ,
3191
3198
struct ufshcd_lrb * lrbp , int max_timeout )
3192
3199
{
@@ -3261,6 +3268,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba,
3261
3268
}
3262
3269
}
3263
3270
3271
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3264
3272
return err ;
3265
3273
}
3266
3274
@@ -3278,6 +3286,9 @@ static void ufshcd_dev_man_unlock(struct ufs_hba *hba)
3278
3286
ufshcd_release (hba );
3279
3287
}
3280
3288
3289
+ /*
3290
+ * Return: 0 upon success; < 0 upon failure.
3291
+ */
3281
3292
static int ufshcd_issue_dev_cmd (struct ufs_hba * hba , struct ufshcd_lrb * lrbp ,
3282
3293
const u32 tag , int timeout )
3283
3294
{
@@ -3365,6 +3376,7 @@ static int ufshcd_query_flag_retry(struct ufs_hba *hba,
3365
3376
dev_err (hba -> dev ,
3366
3377
"%s: query flag, opcode %d, idn %d, failed with error %d after %d retries\n" ,
3367
3378
__func__ , opcode , idn , ret , retries );
3379
+ WARN_ONCE (ret > 0 , "Incorrect return value %d > 0\n" , ret );
3368
3380
return ret ;
3369
3381
}
3370
3382
@@ -3376,7 +3388,7 @@ static int ufshcd_query_flag_retry(struct ufs_hba *hba,
3376
3388
* @index: flag index to access
3377
3389
* @flag_res: the flag value after the query request completes
3378
3390
*
3379
- * Return: 0 for success, non-zero in case of failure.
3391
+ * Return: 0 for success; < 0 upon failure.
3380
3392
*/
3381
3393
int ufshcd_query_flag (struct ufs_hba * hba , enum query_opcode opcode ,
3382
3394
enum flag_idn idn , u8 index , bool * flag_res )
@@ -3432,6 +3444,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
3432
3444
3433
3445
out_unlock :
3434
3446
ufshcd_dev_man_unlock (hba );
3447
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3435
3448
return err ;
3436
3449
}
3437
3450
@@ -3444,7 +3457,7 @@ int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
3444
3457
* @selector: selector field
3445
3458
* @attr_val: the attribute value after the query request completes
3446
3459
*
3447
- * Return: 0 for success, non-zero in case of failure.
3460
+ * Return: 0 upon success; < 0 upon failure.
3448
3461
*/
3449
3462
int ufshcd_query_attr (struct ufs_hba * hba , enum query_opcode opcode ,
3450
3463
enum attr_idn idn , u8 index , u8 selector , u32 * attr_val )
@@ -3493,6 +3506,7 @@ int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
3493
3506
3494
3507
out_unlock :
3495
3508
ufshcd_dev_man_unlock (hba );
3509
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3496
3510
return err ;
3497
3511
}
3498
3512
@@ -3507,7 +3521,7 @@ int ufshcd_query_attr(struct ufs_hba *hba, enum query_opcode opcode,
3507
3521
* @attr_val: the attribute value after the query request
3508
3522
* completes
3509
3523
*
3510
- * Return: 0 for success, non-zero in case of failure.
3524
+ * Return: 0 for success; < 0 upon failure.
3511
3525
*/
3512
3526
int ufshcd_query_attr_retry (struct ufs_hba * hba ,
3513
3527
enum query_opcode opcode , enum attr_idn idn , u8 index , u8 selector ,
@@ -3530,9 +3544,13 @@ int ufshcd_query_attr_retry(struct ufs_hba *hba,
3530
3544
dev_err (hba -> dev ,
3531
3545
"%s: query attribute, idn %d, failed with error %d after %d retries\n" ,
3532
3546
__func__ , idn , ret , QUERY_REQ_RETRIES );
3547
+ WARN_ONCE (ret > 0 , "Incorrect return value %d > 0\n" , ret );
3533
3548
return ret ;
3534
3549
}
3535
3550
3551
+ /*
3552
+ * Return: 0 if successful; < 0 upon failure.
3553
+ */
3536
3554
static int __ufshcd_query_descriptor (struct ufs_hba * hba ,
3537
3555
enum query_opcode opcode , enum desc_idn idn , u8 index ,
3538
3556
u8 selector , u8 * desc_buf , int * buf_len )
@@ -3590,6 +3608,7 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba,
3590
3608
out_unlock :
3591
3609
hba -> dev_cmd .query .descriptor = NULL ;
3592
3610
ufshcd_dev_man_unlock (hba );
3611
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3593
3612
return err ;
3594
3613
}
3595
3614
@@ -3606,7 +3625,7 @@ static int __ufshcd_query_descriptor(struct ufs_hba *hba,
3606
3625
* The buf_len parameter will contain, on return, the length parameter
3607
3626
* received on the response.
3608
3627
*
3609
- * Return: 0 for success, non-zero in case of failure.
3628
+ * Return: 0 for success; < 0 upon failure.
3610
3629
*/
3611
3630
int ufshcd_query_descriptor_retry (struct ufs_hba * hba ,
3612
3631
enum query_opcode opcode ,
@@ -3624,6 +3643,7 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
3624
3643
break ;
3625
3644
}
3626
3645
3646
+ WARN_ONCE (err > 0 , "Incorrect return value %d > 0\n" , err );
3627
3647
return err ;
3628
3648
}
3629
3649
@@ -3636,7 +3656,7 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
3636
3656
* @param_read_buf: pointer to buffer where parameter would be read
3637
3657
* @param_size: sizeof(param_read_buf)
3638
3658
*
3639
- * Return: 0 in case of success, non-zero otherwise .
3659
+ * Return: 0 in case of success; < 0 upon failure .
3640
3660
*/
3641
3661
int ufshcd_read_desc_param (struct ufs_hba * hba ,
3642
3662
enum desc_idn desc_id ,
@@ -3703,6 +3723,7 @@ int ufshcd_read_desc_param(struct ufs_hba *hba,
3703
3723
out :
3704
3724
if (is_kmalloc )
3705
3725
kfree (desc_buf );
3726
+ WARN_ONCE (ret > 0 , "Incorrect return value %d > 0\n" , ret );
3706
3727
return ret ;
3707
3728
}
3708
3729
@@ -3816,7 +3837,7 @@ int ufshcd_read_string_desc(struct ufs_hba *hba, u8 desc_index,
3816
3837
* @param_read_buf: pointer to buffer where parameter would be read
3817
3838
* @param_size: sizeof(param_read_buf)
3818
3839
*
3819
- * Return: 0 in case of success, non-zero otherwise .
3840
+ * Return: 0 in case of success; < 0 upon failure .
3820
3841
*/
3821
3842
static inline int ufshcd_read_unit_desc_param (struct ufs_hba * hba ,
3822
3843
int lun ,
@@ -4794,7 +4815,7 @@ static int ufshcd_complete_dev_init(struct ufs_hba *hba)
4794
4815
* 3. Program UTRL and UTMRL base address
4795
4816
* 4. Configure run-stop-registers
4796
4817
*
4797
- * Return: 0 on success, non-zero value on failure.
4818
+ * Return: 0 if successful; < 0 upon failure.
4798
4819
*/
4799
4820
int ufshcd_make_hba_operational (struct ufs_hba * hba )
4800
4821
{
0 commit comments