Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: 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.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20251111184802.125111-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
18987143 10282589

+1 -1
+1 -1
drivers/ufs/core/ufs_bsg.c
··· 105 105 106 106 if (dir != DMA_NONE) { 107 107 payload = &job->request_payload; 108 - if (!payload || !payload->payload_len || !payload->sg_cnt) 108 + if (!payload->payload_len || !payload->sg_cnt) 109 109 return -EINVAL; 110 110 111 111 sg_cnt = dma_map_sg(hba->host->dma_dev, payload->sg_list, payload->sg_cnt, dir);