From 8361526317382b8064dc427df8099bc87bf0e37e Mon Sep 17 00:00:00 2001 From: Sriman Achanta Date: Fri, 23 Jan 2026 18:14:31 +0000 Subject: [PATCH] Apply 3 suggestion(s) to 1 file(s) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Barnabás Pőcze --- spa/plugins/alsa/alsa-udev.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c index 2957f304d..e06801c87 100644 --- a/spa/plugins/alsa/alsa-udev.c +++ b/spa/plugins/alsa/alsa-udev.c @@ -320,7 +320,6 @@ static bool is_usb_interface_dir(const char *name) static char *check_wireless_status_at_path(struct impl *this, const char *path) { char wireless_path[PATH_MAX]; - char *result; int res; res = spa_scnprintf(wireless_path, sizeof(wireless_path), @@ -331,10 +330,7 @@ static char *check_wireless_status_at_path(struct impl *this, const char *path) if (access(wireless_path, R_OK) < 0) return NULL; - result = strdup(wireless_path); - if (!result) - spa_log_error(this->log, "failed to allocate wireless_status path"); - return result; + return strdup(wireless_path); } static char *search_siblings_for_wireless_status(struct impl *this, const char *parent_path) @@ -424,8 +420,7 @@ static void update_wireless_status(struct impl *this, struct card *card) if (status == WIRELESS_STATUS_UNKNOWN) { spa_log_info(this->log, "card %u wireless_status unreadable, removing monitor", card->card_nr); - free(card->wireless_status_path); - card->wireless_status_path = NULL; + spa_clear_ptr(card->wireless_status_path, free); card->wireless_disconnected = false; return; } @@ -1093,8 +1088,7 @@ static struct card *find_card_by_wireless_status_path(struct impl *this, const c return NULL; for (unsigned int i = 0; i < this->n_cards; i++) { - if (this->cards[i].wireless_status_path && - spa_streq(this->cards[i].wireless_status_path, wireless_path)) + if (spa_streq(this->cards[i].wireless_status_path, wireless_path)) return &this->cards[i]; } return NULL;