Skip to content

Conversation

@alexapostolu
Copy link
Contributor

@alexapostolu alexapostolu commented Jun 2, 2025

Remove logically dead if and else-if conditions as shown by the static analysis (#90531 ), replacing with the else statement.

When data_opt is assigned to the MIN of fifo_wmark_cfg and fifo_full_cfg, both those variables will be non-NULL as an earlier condition ensures the function returns if either one of the variables is NULL before assigning to data_opt.

Condition that ensures the function returns if either one of the variables is NULL,

	bool fifo_full_irq = false;

	if ((fifo_wmark_cfg != NULL) && (fifo_full_cfg != NULL) &&
	    FIELD_GET(ADXL372_INT1_MAP_FIFO_FULL_MSK, status1)) {
		fifo_full_irq = true;
	}

	if (!fifo_full_irq) {
		gpio_pin_interrupt_configure_dt(&cfg->interrupt, GPIO_INT_EDGE_TO_ACTIVE);
		return;
	}

Fixes #90531
Fixes #90550

@MaureenHelm
Copy link
Member

@vladislav-pejic can you take a look?

@alexapostolu
Copy link
Contributor Author

Force pushed to fix commit message being too long

Remove logically dead if and else-if conditions as shown by the static
analysis, replacing with the else statement.

When data_opt is assigned to the MIN of fifo_wmark_cfg and fifo_full_cfg,
both those variables will be non-NULL as an earlier condition ensures the
function returns if either one of the variables is NULL before assigning
to data_opt.

Signed-off-by: Alexander Apostolu <apostolu240@gmail.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jun 4, 2025

@alexapostolu
Copy link
Contributor Author

@MaureenHelm just pinging again to get this reviewed, thanks!

@kartben kartben merged commit 2e7ec2b into zephyrproject-rtos:main Jun 17, 2025
26 checks passed
@alexapostolu alexapostolu deleted the alex/dead-code branch June 18, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Sensors Sensors platform: ADI Analog Devices, Inc.

Projects

None yet

4 participants