From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795891483; b=XpbtDUyVP8eHH9I2SKnWHYo1dEBEdareItSAwNmCMfaXVIzDDVOx3NupMkKtnPPDp45G b3n4n4EEYRpebmOOwepUI4bUzqgW2WQjLH/4rG5jDlJzxop5X8qGOhljnUWSsNy4C4XnS 0+rALM92av0fuI1ZQdb12C0DcH6b3Kfjx2R6n3mcH7YZR/xOwdxmH5bTIGJm+i8DgLZeK fQSjsRzIzQWtWSCNXgE5+I1xLm0BDaai8DnMSQBsUmsGwv3hmmfC+ljDmuHmDt/SWrOge TiTVJk46HW7oiFFIneET9+EmEhDtlaWo7f6JTPe7d3bv81twlmEJcRHDXWxR7SSar2g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795891483; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=0mW8neNEAA+rYruHa8oSVmL6R/jULS7vlsuXFmDOZq8=; b=g6DWBxbf0lY4Qz/CCJnJcXYkEUq7uguf3L3bKRyyCdpg+pzIDCOwy4d7kXoHjkMoyvv7 acer+MCCK2RLuZzOIMHzZoHaBCH0lW5ohRr1snCHQ+2pviDMy5EYLchIXwxdNCNKQ0m2z JPkBbOZSojbLvog9/mHLceKp/UA+5ojIoVilZ+9gZMivkhU9wHZtNBIVbE3+j5WUjbG9q NJ6JmxU31ILMYlx+To043SPVuo6VBRL5VEVDvyWXWQcALcVdo1GkW95sexACiUczwsuLj hFPns/LxWTBYOugE7OliBPYBvOUODn4AbcWjMYqAIqb1uPPaK3NE8vGiMpoa88+y2IQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=gf+jEdCZ; arc=none smtp.remote-ip=209.85.160.173 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85DF0606A325 for ; Sat, 28 Nov 2026 18:44:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 85DF0606A325 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.a=rsa-sha256 header.s=20260707 header.b=gf+jEdCZ Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-5363316fa0cso95644941cf.3 for ; Sat, 28 Nov 2026 10:44:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795891482; x=1796496282; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0mW8neNEAA+rYruHa8oSVmL6R/jULS7vlsuXFmDOZq8=; b=gf+jEdCZHDLyR8EqJmCpqVqZeUOX96ieoptWHNDFhXc/77BP/YmP38SVywxf/uQhSc 9TMm/gq4RYmdA4LmdJ/4+Gx7m+PjYGm+kxHBNl4a5fxJAlG8wXdn2xu0FQiIXPPz49Vc LmSR+McVblgprkr8b3oiOfPbv4wfJDwPA9j7IvWONQ9d4zSr7mNuZR6FNr3UjO2gOXmK 7+IJsIvG/FbZHhBNWVnZaM04oQ5jUnsksGJjRqwg8D6p9H+yJeKgiwRcvCPwSEZzwWeY uj5DKyIPcmRc0flLCbQ7AOAMhBNr94Ny7pXtV2z61SQgRVCB14D5Yw8ekWqeThmp+khI z4MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795891482; x=1796496282; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0mW8neNEAA+rYruHa8oSVmL6R/jULS7vlsuXFmDOZq8=; b=UIk5NPeTY2z0sPcarxqGCQZyTWXevBIatrQq06KKPPKedk85oXobD6L2w1KTTvrH0+ dioDy9BN64i5iloibdtVRRUQAYEfXSD7YFPbdRgDWY49GwZuscM8x6yjRhu+HKFlb9EY /GCxPmfEE0cG4NjOBsFIWaf8lwr++kIDdMFNsxizF9DPKKW7EmpxZ1V7R/ZrvSQhFKIv y9R6fgUONV4eLnUcIF2b8vs6VWROgt+ckg/++D2q9AQ9APb63+S0wpLXl7p6/phLPbDj maGQARFTQo1sVHY4vI6JFs1JD3UmdBPvK/2fIQjJVkYX35OITDnfChgA5p5vScMR6NgU rECg== X-Forwarded-Encrypted: i=1; AL+hErEqHkP0ZcVoYeLETvJscsze6ndeh+FmsCp7c6FJXjV9LQ7VloD113U8VymzDj7lTAWJJ6dQUb7eJ/w=@vger.kernel.org X-Gm-Message-State: APuU4Z+OPaPBJkQH/C2My4Je2pWqWJt6ktgV/jmnomWFKbXOnHMrRPPX 9EDomtKmWZO1ABnSr0y3I3xgtwcHF72Njc+KYTtoetqEbD7jo1B+K6iL X-Gm-Gg: AZFdTZfbXCBfmaVZBCtGvdZMwr1dmwfuX6Oc0CGRYlzXTQkp+oyk1QWgK5QVRO7gMh1 cgtYdZWXkFDhgqzn/WyXU7qxWS+wvK3nR6oJpmr6hQiOKGf3q3JkH1n7sFQvNH07prO68LdHoWx W24Gpbch9OW1wNBP4qgbg3YqAvfzeKXu7xRqxKpmsPZYHB5hRmzkZ2T8UDk4mJAQht5YsXB0yXg IvuOB9TZb2Og4vXjYHaqZe+Z1bFbzFuy9pu5Yu7DTJgtOUsCNb/tKuY42GXQTLgBLUVeGmmmgzZ 9/d2mVzoFc/CWkPJ2mVQ9rm5dzDc++G0AySwl23YkHynpyeHQqKN2Fb0Cbx0/W+gQKHHYqij6Zp AXSEgdhVyG3+paCccRnPhxMVTC0Q7Uc/vxmcz15Jem5Ynl0iWeYTEG0KJBSND9lqO+bqZPXS1Po b75HzbfaMDc2M5LkVgJkHONUnddBqZBR9G4C1GBztWDh9LGOPzpbZVRkKmwSdIMUqWww3xQCiMa h9ZvlsfU6JyOtXN6oyreB+RRFXnbmxG2qZsaUEC5mP4f8fqk75dQ9chuoe9DqDtiMcEwfqwbHy4 JqVAnca8CYM5lACGs6hFF2iXD2GMNBENcPRK X-Received: by 2002:a05:622a:2283:b0:535:1b18:202 with SMTP id d75a77b69052e-55d769ea03cmr524704221cf.16.1795891482424; Sat, 28 Nov 2026 10:44:42 -0800 (PST) Received: from localhost ([2600:4808:5693:8201:394e:8b9f:994c:b59f]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d7889ea4csm238521611cf.26.2026.11.28.10.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2026 10:44:41 -0800 (PST) Date: Sat, 28 Nov 2026 13:44:37 -0500 From: Marco Chen To: David Kahurani Cc: Arnav Kapoor , Jonathan Cameron , 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: References: <20261127085722.126797-1-marcochen.dev@gmail.com> <20261127113640.215803-1-kapoorarnav43@gmail.com> 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-Disposition: inline In-Reply-To: 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. Marco