From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 4F0412417D1 for ; Tue, 17 Feb 2026 13:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771336228; cv=none; b=gcaPshI5/RmknpNZ9sfP7qw5RDav9SKPQdDlXI2zh5tE7B+htylRnP1No847SvQsqBuJuhTgFCHI+TDTRZYgGe9t5xRZi+6aCyHXYjRUgMwXYTV9SqYoZkxOtxuvT37cr6aiwEjjmIcTJlSbCLhb5HOkyJC8HP5ilieKeJazPRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771336228; c=relaxed/simple; bh=KqWSYmoe1gwHCzwLn/Y/QlhXGc4KV4LVs+VRcOcr0d8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=tmMqEqMCgf4cBHNocQXSCcwPENdn86RBfHBPFZJEuSIdCXEcPjXjq3YQESML8GgVYRCBpHJUA86deZJObDU5pNLbeaVadeMnfyX6I4rJqfg8tto1EKqa4/y4vJJ8NW6j7KhuRhAnqQo5IQ2bIV9xaujwg5sRGG/q+BG7lo+CG9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D3OH7bjr; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D3OH7bjr" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-4362507f396so4073639f8f.0 for ; Tue, 17 Feb 2026 05:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771336226; x=1771941026; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=KqWSYmoe1gwHCzwLn/Y/QlhXGc4KV4LVs+VRcOcr0d8=; b=D3OH7bjrPZBzeu4HBh8HKwcm56qPFA3PElGejON2ZONYS9PJSTLdkMZrPISg8WvEV3 fUqxy0uiG/X6sLt1sIXB6yCMlCeYz0pkaCKUtBIWOD0usHAga/zASFFlZBHvOagzA200 4tm8fTba/OGHqG8bKujqNdUVDJiPlU8KfCB7JvdsIm0jNXeSiUh49N3UVCBFZIvhxq3p 26I8x5y5a6gV93Wlm8n4KUc3UYak3yINTOXhy2Wl4ufLISJLU7/iSd4TADXPYhbTWe66 tes9t2DYSzDm0E0BDI1q/aqnlxkvsQdG3uFZ2+b0AR+AkUe8nbirGLidC1MWb9xaL+wX V2/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771336226; x=1771941026; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KqWSYmoe1gwHCzwLn/Y/QlhXGc4KV4LVs+VRcOcr0d8=; b=megGy4Y03lg3vWsVgljLe2LTF7IT9JBp9W0MlRt/yuLfXuejT3h6EIuJu2lwZ8KRen hIVMUEZen1tcR/InNtDBn/3yVoBFyTr2PcxhSnFwzU4RsNXTF4j4yTpZTkbvOY0F4jE0 nB19BEE/32qTNAgZJkhzuMOKMOUO3MwTaHj8bIsxsqPW9u0BV6jB/124J07xcyr96I4/ xzHTVUFwd2ckAgQTQH5j4mm6U2cDnaIaCwxzJYYDVZTeKO6v0veUVDM7v2SkEd+p32Id YLyPi9Jk5YXdOsLokYPEnkt7Zy+dWT5gWDF4oepm/OFLgGXz6bayHwYQBvvv45RtDAPl 2MCw== X-Forwarded-Encrypted: i=1; AJvYcCUlFWuFfJzEqjP7vl94mhcaIoyKWg9DyLtpbyW9kwIAbeTVPYldqndBNl4oS8G+vCvtZ4ODUQunm/Oyq3U=@vger.kernel.org X-Gm-Message-State: AOJu0Yytj9/8ZLEG3x5m5o/2ZVkZ9Q5+CxBQKPpAla4tWIgU85jSEeex VERamr0GiYqirZ8cUFjPIhjqu8kF4i5GmL6iS6uixJONRJpPzKy6vuol X-Gm-Gg: AZuq6aINdIKnPQNLNy8aIUOHFjlqpcsBxM0xmhuL/847DVFcQs4uuQLkTnqxg22b7cC c9jpiW+jm2hDNB1azXp5hwidhcteiUnEW7G+Sr+Qx21iyo/usTpT5POKVyOBr4CiNv1ak/M0WT7 rrAxiJgrVywCcNrC4ndWH+a+bkWaYszSSARbFxZhp8NW3gF/YaE4trjaYGM8qUhPP9gj3hIUlbV 4nfM/uoOfZDzVjZmxqvU9Ga/2rhOXjz0cigGdJIgm8R7aUiPtQvg+hGCmANWcmJbA9D/jsiKvNF bDlSmybF08zVY1uOtXgcpaoP0Rxu9lvGfwQQLI3DW/COlGf3kzNBfIxVnLlGuA4TuJ9elMK6UfT cRbwbu1xsene90YFslD2UfuC0+wuUr10W77Bgxml8aBB4wFsdmIzc5GnT5T3dRNDXxzxZXog/27 7b5F0dy0VYe0fIZo5t45IfKGmVzPcDVK4= X-Received: by 2002:a05:6000:220d:b0:435:bd00:cb4 with SMTP id ffacd0b85a97d-437978dd6camr25877144f8f.23.1771336225517; Tue, 17 Feb 2026 05:50:25 -0800 (PST) Received: from [192.168.1.187] ([148.63.225.166]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43796a6ba57sm28189227f8f.15.2026.02.17.05.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Feb 2026 05:50:25 -0800 (PST) Message-ID: <96b05a514d229b23ea0917447607dd7390ec0e2e.camel@gmail.com> Subject: Re: [PATCH v3] iio: trigger: use put_device() in viio_trigger_alloc() error path From: Nuno =?ISO-8859-1?Q?S=E1?= To: Salah Triki , Andy Shevchenko Cc: Jonathan Cameron , David Lechner , Nuno =?ISO-8859-1?Q?S=E1?= , Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 17 Feb 2026 13:51:08 +0000 In-Reply-To: References: <20260215222348.186806-1-salah.triki@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Mon, 2026-02-16 at 09:45 +0100, Salah Triki wrote: > Hi Andy, >=20 > You are absolutely right. My previous version (v3) was logically flawed a= s > it could trigger the release callback before the necessary fields were > initialized, leading to an unsafe irq_free_descs() call. >=20 > Since I don't have the physical hardware to perform runtime injection > tests,I relied on manual code path analysis and clearly failed to account > for the side effects of put_device(). >=20 > I'm sending a v4 which takes the safer approach: moving > device_initialize() after all potential failure points. This way, we can > safely use kfree() and irq_free_descs() in the error path without > involving the device lifecycle prematurely. >=20 > Thank you for the catch. Please just use the same approach Andy did for iio_device_alloc(). I posted= links (in one of your versions) to that and for the discussion we already had on this same functi= on some time ago. - Nuno S=C3=A1