mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-17 16:51:44 +08:00
Fix uninitialized object usage in igc 6.12.
This commit is contained in:
@@ -268,6 +268,11 @@ int igc_led_setup(struct igc_adapter *adapter)
|
||||
|
||||
mutex_init(&adapter->led_mutex);
|
||||
|
||||
if (get_ecdev(adapter)) {
|
||||
adapter->leds = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
leds = kcalloc(IGC_NUM_LEDS, sizeof(*leds), GFP_KERNEL);
|
||||
if (!leds)
|
||||
return -ENOMEM;
|
||||
@@ -295,6 +300,10 @@ void igc_led_free(struct igc_adapter *adapter)
|
||||
struct igc_led_classdev *leds = adapter->leds;
|
||||
int i;
|
||||
|
||||
if (get_ecdev(adapter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < IGC_NUM_LEDS; i++)
|
||||
led_classdev_unregister(&((leds + i)->led));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user