From patchwork Thu Jan 30 17:45:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13954793 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C695145B14 for ; Thu, 30 Jan 2025 17:45:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738259143; cv=none; b=N5XjU4sYUzndfPZ3bM9EBseSbvySZbZEjAzwEd7KIOJg0j1c3UEgDxOYzpI1drDBqo3YaL7d64oDd2MKBUlJWP3DwBswtrQOUSS0taSnAB/O3DBZhGnqmuINIZqbh72PAiKgerXL3TPBv44jnfrPTZTx8s9k40cRMztL6Hd8cnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738259143; c=relaxed/simple; bh=vfDZnD6Ua2cIA/ztLux1e4U1IfeXvqAsCFCH/wOVvIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Py+SZhLSjQQxnjprmnvvXSj1DXulrb4WfyxtC0Mee1FLI8igRsRXbDlY+3lYYtbVrIMDRbPXioIueizLGahLBIG/lwv5Qi7tjLeulS0JeCJfypQLlxt5Mh+hTqgtgWbHHi0HHL8VRvxbkIjpim1ADjo3AXfKBQiFuh9rytoLeYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=F8bTpC5G; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="F8bTpC5G" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-aaeef97ff02so198879466b.1 for ; Thu, 30 Jan 2025 09:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1738259139; x=1738863939; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M1mh9nnX3GcIceAhA1b8AUp6XBg9evpAuAnvXOh3LTM=; b=F8bTpC5GD5T+LPaVBhlHPKmxVLM5RE9YIz+tfblLwaAh1+tBfa+c4hRhVbJ8p1HsXS h0307+JF37menQBC3s7wuH+bkP2FeESpOe9lYphdOBzLy0Z8R6r6DCWE3L+hkitoVjUm rXzraUvBldh5iDlXylNqaPpeie8RKKuRADFrAoiTvSboKfcBFgYwoD09RuIEGfQnc7Le AaWASp5+5aB2b7pCBzI6CA6mH61kMWg+/Be1BNPQnNKIAc4n5wvoRWAOXE/pojcsPMOX O5INXgQS1gI7dvcQ97W6zq14/arD2IvkfyyMW9a8MUocm98EVp/X6iJcY8/YUKC2Xz3j n/uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738259139; x=1738863939; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M1mh9nnX3GcIceAhA1b8AUp6XBg9evpAuAnvXOh3LTM=; b=QL6JSsEdpfjYaPegasYQnBLJ5Y8cDnFUufumnEtkJy+LHn/JMefizUaMTawLx6bfXb x5MjY8tubkLykMwrwdcMDQZLwwn5yS7FSrx2DS75lldYSUnfbQBAWQhA8U8hA+uNjT68 loQIBD+KMUWsyTD7n4JEgwQRelQ17+umXWOiIpqsMM3qRicPzkw6SXPMXqowBd6RX9G7 1M4HGOOwxQalXNjAwcfQKBcjjBb5/aPiFdfugBMP0KbgsTmuhHPuCxPbaYnFQmjfT+WE HhekhnFjuNkoiYLv7GKNgFYE2psRFIubKeKWGmWDtpmDDEVYbPriJSFRTAOzYGBdkiVY Fe7g== X-Gm-Message-State: AOJu0Yyl5M0XJXNFU8qySEto+Oh9sWvdEojJrcCEzMWCG31J5jfwHkTN hrsYOJFlV79iT3DRC2m+SsbE1CtQj3mmqvow2QYy82//qNpnbgl00SxYHkNivRI= X-Gm-Gg: ASbGncvo04vnasce/grANF76aLjhLge1E2JE7ofmO8KASkhp+k7EtP3UiOFbGGxZkqk N76W2goVuKEzsM2N48W0fluEhgM5SD619uw2fUAaDhM76886xNPX5U2dLwtj+pwLE3NE1sx8yug /tkIlJtcxCzifwxQuKbpdoktBNZ4F1TJjNnt4c/VE5C/17jXJB31ghRPEllSLyIYWYvNTxy9Ih7 qud46QvduRxRc1ricG/n8mO6x6ULBMJXo4/hrZf2X0aO+Np2WPY9wK92tEtEv4IS1uLTnRCvQvA LiCNShpxHUTrSbn8Furu X-Google-Smtp-Source: AGHT+IHYs3eZeXwcebr9dCJF77gZnhTDDQcoQESrfxGhuXXUNS8yPDc5g4gMztI1b/ZM5qlqU9zA9g== X-Received: by 2002:a17:907:2d8f:b0:aaf:117f:1918 with SMTP id a640c23a62f3a-ab6cfcb35a6mr902370366b.5.1738259139511; Thu, 30 Jan 2025 09:45:39 -0800 (PST) Received: from localhost ([2a02:8071:b783:6940:36f3:9aff:fec2:7e46]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a5ada4sm152012766b.184.2025.01.30.09.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2025 09:45:39 -0800 (PST) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Michael Walle , Nuno Sa , Andy Shevchenko , Dumitru Ceclan Cc: linux-iio@vger.kernel.org Subject: [PATCH 1/2] iio: adc: ad4130: Fix comparison of channel setups Date: Thu, 30 Jan 2025 18:45:01 +0100 Message-ID: <584b8bae1ad158fc86bd1cd9bd3dcae54b58093e.1738258777.git.u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2791; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=vfDZnD6Ua2cIA/ztLux1e4U1IfeXvqAsCFCH/wOVvIo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBnm7qfGIydDjX4VExoVoHQfEzg14xyrLD1tBYd5 DLnbt9eth6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZ5u6nwAKCRCPgPtYfRL+ TrU6B/98llaKA6w/CCVAmRZgqsDFRe6bdFr8L0ejegpghN/JdlP5Ly8/RL/yaEPiD7a1xtvkmcK /9kt3OrpQrpreJNXHLMb/+dA56b65PVOIk1hoIIHCdmwgabZ0AR+7SZ5XmESp1Lod9U0hN8su9O HK0MuD2NJYB6wT8paWN6Bn31fZbrFXs+maqgRMQZkPNcIurZga23Mo+5GPioChOZPoGWL2C5kMC +9g9m43SUR3JfHdc6objEQa3lvSWoum9QXM5AOFKK2SWxqo45FnYwG5wIaWVaU12d+WL5K7Sjq1 JZ0Hie5mO5yV1aZGxU31MY8foLaZpC9Qb1jCo8uG5rK7Raue X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a BUILD_BUG guard to (somewhat) ensure that when struct ad4130_setup_info is expanded, the comparison is adapted, too. Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver") Signed-off-by: Uwe Kleine-König --- drivers/iio/adc/ad4130.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad4130.c b/drivers/iio/adc/ad4130.c index de32cc9d18c5..ae321df426b5 100644 --- a/drivers/iio/adc/ad4130.c +++ b/drivers/iio/adc/ad4130.c @@ -591,6 +591,36 @@ static irqreturn_t ad4130_irq_handler(int irq, void *private) return IRQ_HANDLED; } +static bool ad4130_setup_info_eq(struct ad4130_setup_info *a, + struct ad4130_setup_info *b) +{ + BUILD_BUG_ON(sizeof(*a) != + sizeof(struct { + unsigned int iout0_val; + unsigned int iout1_val; + unsigned int burnout; + unsigned int pga; + unsigned int fs; + u32 ref_sel; + enum ad4130_filter_mode filter_mode; + bool ref_bufp; + bool ref_bufm; + })); + + if (a->iout0_val != b->iout0_val || + a->iout1_val != b->iout1_val || + a->burnout != b->burnout || + a->pga != b->pga || + a->fs != b->fs || + a->ref_sel != b->ref_sel || + a->filter_mode != b->filter_mode || + a->ref_bufp != b->ref_bufp || + a->ref_bufm != b->ref_bufm) + return false; + + return true; +} + static int ad4130_find_slot(struct ad4130_state *st, struct ad4130_setup_info *target_setup_info, unsigned int *slot, bool *overwrite) @@ -604,8 +634,7 @@ static int ad4130_find_slot(struct ad4130_state *st, struct ad4130_slot_info *slot_info = &st->slots_info[i]; /* Immediately accept a matching setup info. */ - if (!memcmp(target_setup_info, &slot_info->setup, - sizeof(*target_setup_info))) { + if (ad4130_setup_info_eq(target_setup_info, &slot_info->setup)) { *slot = i; return 0; } From patchwork Thu Jan 30 17:45:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13954794 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F00A17DE2D for ; Thu, 30 Jan 2025 17:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738259145; cv=none; b=ktC9gbmF2uObw2T3O0uofufWaATYmovA/JY8OyJ/D7yXlIhFqw2qam99J7fdsL+zBuCSoQx6+nSKoA1Ts36ae+pMYO5buoTx2MC4MintaVjdZtM+7aj0qMQ3URlYs3EOQng8hvK7gUXrNDV8lP1bJ3Sz36P2b79DjCmkTaBbofo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738259145; c=relaxed/simple; bh=2gt7W7B1flK5Lm7UMyz0fy5QgMMvGcib6qdXYcbf70E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HDssRMMT/4AWFTmFTHXn7ohG84KXdC+628Gmx9l2YUmTEz8fF0cT4DaF9BESMHpXFSaouoVw8F70vYT4v0hJayI6EXrGCdVJP8AxVoNV1Rn94xq/YwCL5C13cvNl2uf1DJv8BrvbDVlyNNgbkEAfNvof8OvLxvOL5gF/03y/bOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=2j8GQH2q; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="2j8GQH2q" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-ab633d9582aso229163166b.1 for ; Thu, 30 Jan 2025 09:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1738259141; x=1738863941; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eME1BWbK8eCibwpVC4K8yuJatIeLGXo3/URu+vw+Ntw=; b=2j8GQH2qg1DB3XwauRB2PCOb79gdW07FbLqTeHQPH7jkxdIgjbbjNhrNsQnHYHBf22 DmUA3DtUlQiSSgNk7g2QohARgxXbZuywoQg78YdzvthjEzeSMbYWCVMVWClS4ep/x7OQ Y758taCEJlTTCID/EYDGGy+Te8E9+Fxop7PwAwspMPAsucQhR/J2tlZahQtmMvuwOPbZ 9cGSM2soDCRE8GKUQSpOZo4T8dIzGrfIOFNQpwysf6F21gb9hhsbZ2n4ohQzpxZpOK0U IFI6EG3Y3FtyYiVOaj5fiwMO5dKWu2mm2ZPOpeBVqo2cb+RUnkiet6jUr/a0f2JPCpcC M+ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738259141; x=1738863941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eME1BWbK8eCibwpVC4K8yuJatIeLGXo3/URu+vw+Ntw=; b=COkwuudnGrBY3LVxx8AENBTnwsfVMGK73EbRlYoaS31fcufagkjKIAPsZVeDLLM5ot LOGzRR2iT1bpvnqMaCR1dQDknEgPZj7SZp8jGaHu3VROzuU/E/O1T84+HHXdT36wYnWw sVTx5AxfKOLWHmQOuqFzIPN5eHWXhBiPjIqq7/Epcp1YXw3W1T9IjVkvxGLWdLt8wAc0 C6+DWl2i4QD2KY6mPD/z/+6dJaQfniCbhDUx1+h4t4nvxrASVIEq4TvBbZAlq/QPegty 5OKnWGb44NDIztcPH6TSwzB1Jp/Aa+IYLQIKJ7Xr9daxKvnR/+mHvDRBthbQ23odlM+H bOPQ== X-Gm-Message-State: AOJu0YwOsbNy1AXy7o64qFoUaYB3QouGPdVvAgqJG7lHIy4eYjSyQWxG CGTEoXCddfjcHMVzu+dBMm/oZLbshgS6acQA714Yz1P3miOMCDk2RT2r6EuUndo= X-Gm-Gg: ASbGncs3QpAgveMWMDAFyIPHtpxUnh3ghD0x/l6YT/Yx29Oow0luGqizzccA0WBuMse xq9/awbVKVWfvUqAG/QUh0uQPsVK7ZTAcLUWTT96ZOuuZWqT3K0Vk7UDXDVXv4zgtKckMBd3lX5 J2hkjcp6oJWdIOcPS861RwwNWm9RLhPVyHudKZ1oJRTiR442GtAUMt60VT5AlB+JpghFvOGT+xu 4/sAvnY0GDT+eE8MX6ERKFu/zkxfxX86nO5l8DDItx752GXv9LEEvQ2hN1AAe3zU95qt4FP4HOh o89D8Fn8E/nQBDXfqq9A X-Google-Smtp-Source: AGHT+IH+xhYr6Y7Qf+eZIP8QxnCDuDzAJEjEpAl1o9oZPXW8FzX4JPdcC3lsYvTCX6z/4j4WEg+Uuw== X-Received: by 2002:a17:906:6a24:b0:aa6:aa8e:c89c with SMTP id a640c23a62f3a-ab6cfda42fbmr911634566b.39.1738259141591; Thu, 30 Jan 2025 09:45:41 -0800 (PST) Received: from localhost ([2a02:8071:b783:6940:36f3:9aff:fec2:7e46]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a31b37sm154736666b.143.2025.01.30.09.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jan 2025 09:45:41 -0800 (PST) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Michael Walle , Nuno Sa , Andy Shevchenko , Dumitru Ceclan Cc: linux-iio@vger.kernel.org Subject: [PATCH 2/2] iio: adc: ad7173: Fix comparison of channel configs Date: Thu, 30 Jan 2025 18:45:02 +0100 Message-ID: X-Mailer: git-send-email 2.47.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2222; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=2gt7W7B1flK5Lm7UMyz0fy5QgMMvGcib6qdXYcbf70E=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBnm7qiKV2Pd/Alp+UnALad0R6Ddm1Q0jTb0gUgK PKHXlfKuFCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZ5u6ogAKCRCPgPtYfRL+ TrGkB/wOzzwx/QMrcUTd34arS24CdJT4KSQCDjSeanKCj/ggzutkuSZt1TUHQwcsNTGpXIx/+Q6 MctEbWvm6vM+1lZjoNaXtml5M5267dovjd2oaCYXcqy2I5VfTj5XRmS6/ygE8RaSLB+UEBDZyXq 0jehUsonJxtoEWtZZUFHPEge64hgaedLvpqCMPdvFKLtgeGyWUfZ6VK9dO04zk1tR6WuaJsNN3B NXBKfqAJFtaqRsTZ+4cKBUDD0UDjoalLNwM02Fch0mBgnmXZ7uWXOLetGXAnCqFVh0ZqxZgHhj4 lpDf1QnjGiiwO4Ft+lpbqd2Ej5C2q3/9LZnKJbMe70bQmbxM X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Checking the binary representation of two structs (of the same type) for equality doesn't have the same semantic as comparing all members for equality. The former might find a difference where the latter doesn't in the presence of padding or when ambiguous types like float or bool are involved. (Floats typically have different representations for single values, like -0.0 vs +0.0, or 0.5 * 2² vs 0.25 * 2³. The type bool has at least 8 bits and the raw values 1 and 2 (probably) both evaluate to true, but memcmp finds a difference.) When searching for a channel that already has the configuration we need, the comparison by member is the one that is needed. Convert the comparison accordingly to compare the members one after another. Also add a BUILD_BUG guard to (somewhat) ensure that when struct ad7173_channel_config::config_props is expanded, the comparison is adapted, too. Fixes: 76a1e6a42802 ("iio: adc: ad7173: add AD7173 driver") Signed-off-by: Uwe Kleine-König --- drivers/iio/adc/ad7173.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index 6c4ed10ae580..67821c889010 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -712,15 +712,24 @@ static struct ad7173_channel_config * ad7173_find_live_config(struct ad7173_state *st, struct ad7173_channel_config *cfg) { struct ad7173_channel_config *cfg_aux; - ptrdiff_t cmp_size; int i; - cmp_size = sizeof_field(struct ad7173_channel_config, config_props); + BUILD_BUG_ON(sizeof_field(struct ad7173_channel_config, config_props) != + sizeof(struct { + bool bipolar; + bool input_buf; + u8 odr; + u8 ref_sel; + })); + for (i = 0; i < st->num_channels; i++) { cfg_aux = &st->channels[i].cfg; if (cfg_aux->live && - !memcmp(&cfg->config_props, &cfg_aux->config_props, cmp_size)) + cfg->bipolar == cfg_aux->bipolar && + cfg->input_buf == cfg_aux->input_buf && + cfg->odr == cfg_aux->odr && + cfg->ref_sel == cfg_aux->ref_sel) return cfg_aux; } return NULL;