mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
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
This commit is contained in:
parent
9ba5502136
commit
3252ee432e
|
|
@ -342,7 +342,7 @@ static int stm_generic_link(struct stm_data *stm_data,
|
|||
{
|
||||
struct stm_drvdata *drvdata = container_of(stm_data,
|
||||
struct stm_drvdata, stm);
|
||||
if (!drvdata || !drvdata->csdev)
|
||||
if (!drvdata->csdev)
|
||||
return -EINVAL;
|
||||
|
||||
return coresight_enable_sysfs(drvdata->csdev);
|
||||
|
|
@ -353,7 +353,7 @@ static void stm_generic_unlink(struct stm_data *stm_data,
|
|||
{
|
||||
struct stm_drvdata *drvdata = container_of(stm_data,
|
||||
struct stm_drvdata, stm);
|
||||
if (!drvdata || !drvdata->csdev)
|
||||
if (!drvdata->csdev)
|
||||
return;
|
||||
|
||||
coresight_disable_sysfs(drvdata->csdev);
|
||||
|
|
@ -384,7 +384,7 @@ static long stm_generic_set_options(struct stm_data *stm_data,
|
|||
{
|
||||
struct stm_drvdata *drvdata = container_of(stm_data,
|
||||
struct stm_drvdata, stm);
|
||||
if (!(drvdata && coresight_get_mode(drvdata->csdev)))
|
||||
if (!coresight_get_mode(drvdata->csdev))
|
||||
return -EINVAL;
|
||||
|
||||
if (channel >= drvdata->numsp)
|
||||
|
|
@ -419,7 +419,7 @@ static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,
|
|||
struct stm_drvdata, stm);
|
||||
unsigned int stm_flags;
|
||||
|
||||
if (!(drvdata && coresight_get_mode(drvdata->csdev)))
|
||||
if (!coresight_get_mode(drvdata->csdev))
|
||||
return -EACCES;
|
||||
|
||||
if (channel >= drvdata->numsp)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user