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

Configure Feed

Select the types of activity you want to include in your feed.

coresight: stm: Remove redundant NULL checks

container_of() cannot return NULL, so the checks for NULL pointers are
unnecessary and can be safely removed.

As a result, this commit silences the following smatch warnings:

coresight-stm.c:345 stm_generic_link() warn: can 'drvdata' even be NULL?
coresight-stm.c:356 stm_generic_unlink() warn: can 'drvdata' even be NULL?
coresight-stm.c:387 stm_generic_set_options() warn: can 'drvdata' even be NULL?
coresight-stm.c:422 stm_generic_packet() warn: can 'drvdata' even be NULL?

Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250611-arm_cs_fix_smatch_warning_v1-v1-1-02a66c69b604@arm.com

authored by

Leo Yan and committed by
Suzuki K Poulose
3252ee43 9ba55021

+4 -4
+4 -4
drivers/hwtracing/coresight/coresight-stm.c
··· 342 342 { 343 343 struct stm_drvdata *drvdata = container_of(stm_data, 344 344 struct stm_drvdata, stm); 345 - if (!drvdata || !drvdata->csdev) 345 + if (!drvdata->csdev) 346 346 return -EINVAL; 347 347 348 348 return coresight_enable_sysfs(drvdata->csdev); ··· 353 353 { 354 354 struct stm_drvdata *drvdata = container_of(stm_data, 355 355 struct stm_drvdata, stm); 356 - if (!drvdata || !drvdata->csdev) 356 + if (!drvdata->csdev) 357 357 return; 358 358 359 359 coresight_disable_sysfs(drvdata->csdev); ··· 384 384 { 385 385 struct stm_drvdata *drvdata = container_of(stm_data, 386 386 struct stm_drvdata, stm); 387 - if (!(drvdata && coresight_get_mode(drvdata->csdev))) 387 + if (!coresight_get_mode(drvdata->csdev)) 388 388 return -EINVAL; 389 389 390 390 if (channel >= drvdata->numsp) ··· 419 419 struct stm_drvdata, stm); 420 420 unsigned int stm_flags; 421 421 422 - if (!(drvdata && coresight_get_mode(drvdata->csdev))) 422 + if (!coresight_get_mode(drvdata->csdev)) 423 423 return -EACCES; 424 424 425 425 if (channel >= drvdata->numsp)