ufs: core: Remove an unnecessary NULL pointer check
Subsystems (2)
Bart Van Assche
reviewerPATCH 1/1 ufs: core: Remove an unnecessary NULL pointer check
The !payload check tests the address of a member of a data structure. We know that the start address of this data structure (job) is not NULL since the 'job' pointer has already been dereferenced. Hence, the !payload check is superfluous. Remove this test. This was reported by the CodeSonar static analyzer.
--- drivers/ufs/core/ufs_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/core/ufs_bsg.c +1 -1
@@ -105,7 +105,7 @@ static int ufs_bsg_exec_advanced_rpmb_req(struct ufs_hba *hba, struct bsg_job *jif (dir !=DMA_NONE ) { payload = &job->request_payload; -if (!payload || !payload->payload_len || !payload->sg_cnt) +if (!payload->payload_len || !payload->sg_cnt)return -EINVAL ; sg_cnt =dma_map_sg (hba->host->dma_dev, payload->sg_list, payload->sg_cnt, dir);
Martin K. Petersen
AppliedBart,
Quoted 5 lines
The !payload check tests the address of a member of a data structure. We know that the start address of this data structure (job) is not NULL since the 'job' pointer has already been dereferenced. Hence, the !payload check is superfluous. Remove this test. This was reported by the CodeSonar static analyzer.
Applied to 6.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Martin K. Petersen
AppliedQuoted 8 lines · Bart Van Assche
The !payload check tests the address of a member of a data structure. We know that the start address of this data structure (job) is not NULL since the 'job' pointer has already been dereferenced. Hence, the !payload check is superfluous. Remove this test. This was reported by the CodeSonar static analyzer.
[...]
Applied to 6.19/scsi-queue, thanks!
[1/1] ufs: core: Remove an unnecessary NULL pointer check
https://git.kernel.org/mkp/scsi/c/18987143d4b1
Signature · 1 line
Martin K. Petersen