Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795915980; b=1msH76RVR5HnMddXtW1tAjfgBizXaQ12SPmXAl/XSQT+XW5Y99PAadxAa/SEiu0sMwb6 b9hCByxSPKkuvmPfArKLjfVJtHt8bHHmHqobC/2ouyZRA/Y3HHYY4IZK7+1FLTKs4yftf Tk5sX4p4NE2yr4Jfx5/9APonwTRrC0BmMGB+I2AfAiJgSSDFmECRPtsNPQqNDMu9pPraH wltPAZMTcq2A65fsiIddoaP+y60DIyQm24NsrU1TIQAzZ+EWN6iZSJiySdYe2mOySnVS0 Rjuxg5OtXwX1tVvsz+mCsfwUOt4Sh6VLUxfOcRjCFOxWDdDu2rlNWDyDYFYlJxl/uPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795915980; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=l5b3L4qd1avxbpli3Dw7dyBO5cPLzUE9Bq7Dq6Ltz+o=; b=NngefaGKqdlR/aJbdvknljCI3l0I5D0vqv35v36iI3Mp5sfQvIptAMOZ4nnPl0hri/lH 05fl7AcgK3RVM8gpmCbiVqfWMoY22eW44QggMsVUT8TpwL6DxhMgaJAtGX9e9Z8k+fmnp O6YyjpMz7B/43/Fj0dSCwIuUqP/58SBxnPgJUA99X6BR4F3ocg3Vrppmqf7O1MGY6EGkI 9B681OgX7kpd1ouugKQ5RHrg8ltTDlx+XBDBT7cXZPxea7SbpZB0OrRgdzuLeQp1PUM/f 8em26CBa3RDvmTJCOqFUaQ6Ndf37z6bc9lf+xDoPwBmtY+2Og0IzKv8P3lxW03vnXoA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dhlkEdrK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B9D5606A31C; Sun, 29 Nov 2026 01:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dhlkEdrK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ADF21F00897; Sun, 29 Nov 2026 01:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795915979; bh=l5b3L4qd1avxbpli3Dw7dyBO5cPLzUE9Bq7Dq6Ltz+o=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=dhlkEdrKmoRSa5T+TMFpTZ87wt6rygdZHlcolqujtRAtNCSY3TyGtwLfa+HerDOLR 7DYDyP0kdB2XcGtcWXbZiSTGHPSZ6cDYdYZKfMLWJ3AuFh7mTIHyl6PxQX8AJGpP/u dYWlF1GlnvSr+sfW4HXZhQCLIINHfirAEzWS/MYB5y+mTIIyHTpcZwSNQHDOH2Kwo4 NekAx6oS6J5gGPhZnIbJjAPAzCooCrfZ32toRty80RJ5ZnLjUKvvRx/SBo/aYB9bjl +PTf3kPcCnaXWmTwvlo9hOWozwGVxihMKFMS5IVRmxINb2+X5ro9T7i5mumaVu/JDy hxt3VKWL8jXdA== Date: Sun, 29 Nov 2026 01:32:51 +0000 From: Jonathan Cameron To: Marco Chen Cc: David Kahurani , Arnav Kapoor , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Hartmut Knaack , Linus Walleij , linux-iio@vger.kernel.org, Shuah Khan , linux-kernel-mentees@lists.linux.dev Subject: Re: [PATCH 0/2] tools: iio: iio_generic_buffer: fix exit status Message-ID: <20261129013251.5548708f@jic23-hlaptop> In-Reply-To: References: <20261127085722.126797-1-marcochen.dev@gmail.com> <20261127113640.215803-1-kapoorarnav43@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 28 Nov 2026 13:44:37 -0500 Marco Chen wrote: > On Fri, Nov 27, 2026 at 02:59:37PM +0300, David Kahurani wrote: > > On Fri, Nov 27, 2026, 14:39 Arnav Kapoor wrote: > > > > > The reason you get that far as non-root, though, is that > > > enable_disable_all_channels() ignores failed writes: it stores the > > > write_sysfs_int() result in ret, only prints a message, and always > > > returns 0 (the ret = -ENOENT at the top is never used either). So the > > > "Failed to enable all channels" check in main() can't fire for a write > > > failure. Returning the error from there, as a separate patch, would > > > make the non-root case fail earlier with -EACCES. Your 2/2 is still > > > useful as a safety net. > > > > > > > Not sure about this... But, in a write and possibly read attempt a return > > code of zero means no operation was performed. That end of file(EOF), zero > > bytes written, zero bytes read etc > > Thank you Arnav for the review, and thank you David for bringing up your > point on the return code of zero. > > For this series though, I did not change how write_sysfs_int() reports > its return value. The value this series changes is only the process's > exit status, where 0 indicates success. That is a different convention > from the number of bytes written from the return code of a read or write > attempt. > > Returning the write error from enable_disable_all_channels(), as Arnav > suggested, would be a good solution to make the non-root case fail > earlier with -EACCES. But, as Arnav said, I think that would belong in a > separate patch. > > Thank you both, again. > Given this is the testing / reference tool and we are fairly late in the cycle I'm not going to rush this in. It has also only been out for a few days but given the deluge of patches at the moment I'm keen to resolve as many as possible quickly. As such applied to the testing branch of iio.git. Thanks, Jonathan > Marco >