Skip to content

Commit

Permalink
mt76x0: fix memory leak during hw probe
Browse files Browse the repository at this point in the history
Fix memory leak during hw probe if mt76x0_register_device fails
since MT76_STATE_INITIALIZED has not set yet and mt76x0_cleanup
does not free tx/rx queues and mcu buffers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Lorenzo Bianconi authored and Felix Fietkau committed Sep 19, 2018
1 parent d1b6eec commit cb722ae
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/wireless/mediatek/mt76/mt76x0/init.c
Original file line number Diff line number Diff line change
@@ -468,9 +468,7 @@ int mt76x0_init_hardware(struct mt76x0_dev *dev)

void mt76x0_cleanup(struct mt76x0_dev *dev)
{
if (!test_and_clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state))
return;

clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
mt76x0_chip_onoff(dev, false, false);
mt76u_queues_deinit(&dev->mt76);
mt76u_mcu_deinit(&dev->mt76);

0 comments on commit cb722ae

Please sign in to comment.