From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796384900; b=vIRFtiZamjrIV03ueFVxa5Z06GntHX45s71bRzQKr5csJXsW42uNrc0GSOn1axqsIB9a pmmfcP/xEXkErUOOyGRXqWlIU33wdUr0Z/CYV4mqCxIjSwntpJR1MtPVsXcE/jRTl+CSA h+F3EInNOt6U5jNxsc4Eag6Pbo6KuphJQSGzq1STwhSwmmEoCL/h90nRSWOmCgoCgyd6e V1iqJfnu8/TA2jC8SiWq41IFnbunCx3gTHQA5ugvv3UXNHAYe1sYvvAlaZfJcMAEuSiHu 5xqJdmwaVUO+v6ZLA8QfnnzGwxc9I/NPzsqyk6hkiHDbykO6WaMB1/Oz5DvoLRYGO9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384900; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=6qg7u0zn4cco1A5NUoMH4nhs5ORR6s7Sjwf1P7NAuBE=; b=15t6Zx8wrq5RE6/GyNBd1gYRgpl90LRLM9XZTp1hvb9ySJTUGZdSZMdi820hYYWk9aXa OWNIe7jmlH4hbN/1ngwYZBbaBj7V6ZnIm63x75qN3h2Sk992KLthY7mVAEKy0+KU0SmHr lqC5zmM9SmK6mIikTJzc6XUHCJTT4x8IQ0W0r/WP2iAJr43xhKrgX0RyUCEEqivWM08Vw KEuf0DQ1py1JHtSKCNkDfoJwd2TQRibRkB2woxiYwkW0feFXNfiA1Wc4wKy/e7CnDQNMl QTWviIsy1Zex13JGlbWBsbA8xjaXfHsY/V35z6N7KoyUJ2nh8ZZpkk8jL8KEuBnyMQA== 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="Tmbm/mxk"; 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 758DD606A334 for ; Fri, 4 Dec 2026 11:48:20 +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=Tmbm/mxk Received: by smtp.kernel.org (Postfix) with ESMTPSA id D03791F00897; Fri, 4 Dec 2026 11:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796384899; bh=6qg7u0zn4cco1A5NUoMH4nhs5ORR6s7Sjwf1P7NAuBE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Tmbm/mxkYGIF4sfcd8RlQ/CNiMStWAnRRrqZ5mBOKq/Dvn0psUbLozQVZ9zp8T7tt 5ZkvKh1mnA0sR+Jlx5WKdTwxdGJp395Vo6YkiXI/Ajf+hE63oMMff1WqStAYqrl4ZE fbwsTug1EUNxxs+lG6hnOY9xYVVigp1QlH+v8uE94scw4i3XIND4k6VHNfZCDwQoz3 ChRr+5AJn/WiAgMt5142WnO+AwDptQX0Kifw9Wa4uV4BkYAQLOCJIbKnt+K/jJXCNv Pq5OpkR9w0vAgywJOgjql9Bp8trA7+WAyYLVfY8vw62Z0qUmYU6DWyAQ6c5BxNg+SP J+zIQLJPr2jhQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] sound: Add a generic result header Reply-To: sashiko-reviews@lists.linux.dev To: "Sreeraj S Kurup" Cc: linux-sound@vger.kernel.org In-Reply-To: <20261204114122.4465-1-sreekuttan2156239@gmail.com> References: <20261204114122.4465-1-sreekuttan2156239@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 11:48:19 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] sound: unidiomatic type-erased struct snd_result duplicates kernel idioms - [Low] sound: add unused public header include/sound/snd_result.h with no callers -- commit 1e31fdcfe3387f0bfdf6718e049b56a19745e76e Author: Sreeraj S Kurup sound: Add a generic result header This commit adds include/sound/snd_result.h defining struct snd_result, enum snd_result_type, and inline constructors for returning an error code, integer, unsigned integer, or pointer from sound APIs. > diff --git a/include/sound/snd_result.h b/include/sound/snd_result.h > new file mode 100644 > index 0000000000000..61503675e7fba > --- /dev/null > +++ b/include/sound/snd_result.h > @@ -0,0 +1,61 @@ [ ... ] > +#ifndef __SOUND_RESULT_H > +#define __SOUND_RESULT_H [Severity: Low] Should this header wait until there are in-tree callers using it? Nothing in the tree includes sound/snd_result.h or uses struct snd_result or any of the snd_result_*() helpers. Without concrete call sites, the header is not build-tested during normal builds and cannot be evaluated against actual sound APIs. Introducing it alongside the first conversions would avoid adding unused infrastructure. > +enum snd_result_type { > + SND_RESULT_ERR, > + SND_RESULT_INT, > + SND_RESULT_UINT, > + SND_RESULT_PTR, > +}; > + > +struct snd_result { > + enum snd_result_type type; > + union { > + int err; > + int i; > + unsigned int u; > + void *ptr; > + }; > +}; > + > +static inline struct snd_result snd_result_err(int err) > +{ > + return (struct snd_result) { > + .type =3D SND_RESULT_ERR, > + .err =3D err, > + }; > +} [ ... ] > +static inline struct snd_result snd_result_ptr(void *value) > +{ > + return (struct snd_result) { > + .type =3D SND_RESULT_PTR, > + .ptr =3D value, > + }; > +} [Severity: Medium] Does ALSA need a custom type-erased struct snd_result when existing kernel patterns already handle these return types? Functions returning a full-range unsigned int with negative errno codes conventionally return int with a typed output pointer, as _snd_hdac_read_parm() in include/sound/hdaudio.h does. Pointer returns use ERR_PTR(), IS_ERR(), and PTR_ERR() from include/linux/err.h instead. Using struct snd_result weakens compile-time type checking: all adopting functions share one return type, snd_result_ptr() drops the pointee type and const or address-space qualifiers, and callers read raw union members without error predicates, accessors, __must_check, or ownership rules. Assigning SND_RESULT_ERR to 0 makes any zero-initialized struct snd_result appear as an error with err =3D=3D 0, and snd_result_err() does not reject non-negative values, so returning res.err on an error path can silently return 0. Returning a 16-byte struct by value on 64-bit targets (or via a hidden stack pointer on 32-bit) also adds ABI overhead for simple integer results. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204114122.4465= -1-sreekuttan2156239@gmail.com?part=3D1