From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-93wp-a23.jellyfish.systems (out-93wp-a23.jellyfish.systems [104.207.68.23]) (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 50AAA437101 for ; Mon, 10 Aug 2026 21:57:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=104.207.68.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786399068; cv=none; b=R/Ih1pEMqcOKns1AxzKTcb1HKvzYHX2c785QB9AgU5QdFnddRJnNpIeBF2NeBwVRgF2C6C50p+yuTb5N0lINhroD0tlGnV9YsrZjHFw8bIZw7unD0cLH8g+xK4HknuYTRLzITmvemaV6JWJhUTTh759HFnKHrmOMNqvbSk3sRUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786399068; c=relaxed/simple; bh=JnAva7BvWlD7HWlrJWTzhueaMfuP/b/E3WgX8cW+Lps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VmvKtwNpkWA1gTyUNkOA1v1rAiOD28M+lRNjYQJ9HfZun8LfSNyS5wq1kzGtT7pgsYO9PVD4HwJgKANsfygGUC/4swk594SXvuSz4p9k6bQk5CQl9DOwMjOB6jJkLgFeFEZzG0TdLiWnm3axzRjtpfAk7/6/Ery2FragXY/Q5Jo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=catcrafts.net; spf=pass smtp.mailfrom=catcrafts.net; arc=none smtp.client-ip=104.207.68.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=catcrafts.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=catcrafts.net Received: from mail.privateemail.com (unknown [87.215.145.39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 4hJpPt4fKNz2x99; Mon, 10 Aug 2026 21:52:18 +0000 (UTC) From: Jorijn van der Graaf To: Andy Shevchenko Cc: Jorijn van der Graaf , Jonathan Cameron , linux-iio@vger.kernel.org, David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org, Kees Cook , "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Weiss Subject: Re: [PATCH 3/3] iio: light: stk3310: support the Sensortek STK36C61 Date: Mon, 10 Aug 2026 23:52:16 +0200 Message-ID: <20260810215216.154484-1-jorijnvdgraaf@catcrafts.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: <20260810110423.41697-1-jorijnvdgraaf@catcrafts.net> <20260810110423.41697-4-jorijnvdgraaf@catcrafts.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Envelope-From: jorijnvdgraaf@catcrafts.net On Mon, Aug 10, 2026 at 09:37:21PM +0300, Andy Shevchenko wrote: > > - if (chan->type != IIO_LIGHT && chan->type != IIO_PROXIMITY) > > + if (chan->type != IIO_LIGHT && chan->type != IIO_PROXIMITY && > > + chan->type != IIO_INTENSITY) > > return -EINVAL; > > Is this now a duplicating a bit with the below choices? A bit, in the int_time and scale arms. The check at the top is pre-existing (this patch only adds IIO_INTENSITY to it) and is the only type filter for the RAW case, which serves all three types through chan->address with no per-type branching of its own. > > case IIO_CHAN_INFO_INT_TIME: > > if (chan->type == IIO_LIGHT) > > ret = regmap_field_read(data->reg_als_it, &index); > > - else > > + else if (chan->type == IIO_PROXIMITY) > > ret = regmap_field_read(data->reg_ps_it, &index); > > + else > > + return -EINVAL; > > If you want to keep a single point of return, use > > ret = -EINVAL; > > here and below in _read_raw(). Neither of the new else branches is reachable today: the colour channels declare RAW only, so no int_time or scale attribute exists for them, and in-kernel readers are gated by iio_channel_has_info(). I would rather keep them than have a bare else read as proximity for a colour channel. v2 writes them with ret = -EINVAL as you suggest, falling into the existing if (ret < 0) return ret. Thanks, Jorijn