drivers/intel/touch: Avoid returning undefined pointer

Currently we may return an undefined pointer called
`none_driver_config` since stack variables are not by default
initialized to 0/NULL.
This also causes an issue when updating to a clang version 21.1.5 from
version 18.1.8, since it complains about this very issue.

returning NULL is fine, since the macros in this file actually depend on
it to figure out where to get the config from.

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
Change-Id: I7b719ca9fd41409375f635b1dcddbc5796b48fe7
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89940
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Maximilian Brune 2025-11-07 18:43:28 +01:00 committed by Matt DeVillier
commit 773997c92d
2 changed files with 10 additions and 11 deletions

View file

@ -178,7 +178,6 @@ enum intel_touch_device {
TH_SENSOR_GOOGLE, /* ELAN9006 for SPI and ELAN6918 for I2C */
TH_SENSOR_HYNITRON, /* NYITRON for I2C only */
TH_SENSOR_GENERIC, /* for device properity thru devicetree */
TH_SENSOR_MAX
};
/*

View file

@ -39,17 +39,17 @@ __weak const struct intel_thc_hidspi_info *soc_get_thc_hidspi_info(void) { retur
static const struct drivers_intel_touch_config *get_driver_config(const struct device *dev)
{
const struct drivers_intel_touch_config none_driver_config;
const struct drivers_intel_touch_config *config = dev->chip_info;
const struct drivers_intel_touch_config *devices[TH_SENSOR_MAX] = {
[TH_SENSOR_NONE] = &none_driver_config,
[TH_SENSOR_WACOM] = &wacom_touch_config,
[TH_SENSOR_ELAN] = &elan_touch_config,
[TH_SENSOR_GOOGLE] = &google_touch_config,
[TH_SENSOR_HYNITRON] = &hynitron_touch_config,
[TH_SENSOR_GENERIC] = config
};
return devices[config->connected_device];
switch (config->connected_device) {
case TH_SENSOR_WACOM: return &wacom_touch_config;
case TH_SENSOR_ELAN: return &elan_touch_config;
case TH_SENSOR_GOOGLE: return &google_touch_config;
case TH_SENSOR_HYNITRON: return &hynitron_touch_config;
case TH_SENSOR_GENERIC: return config;
case TH_SENSOR_NONE: return NULL;
/* no default so that we get an error in case someone forgets to add a case here */
}
return NULL;
}
/* Use only Device-tree definition. */