From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 1FC992253FC for ; Wed, 1 Jul 2026 05:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782882288; cv=none; b=eZAPWwxZrgDp4bLIzw3pZbszridJJ8VAs3zwiX/+5SxQqlY+tsgTgIovJOyl5ChKJzSsYJh5xRINEcxN5gqGyROqef0p3zjhkPT5POZCYKKZwVx11mrEyPAdHozgO3tE/kQMwn6i9bQEstlB8XReeCIzaO9qw8OYfnExVQQrLqI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782882288; c=relaxed/simple; bh=rvm+4uEtAJwTSt2QHnNUd5p40BFoClhDEOgDK5i6ytI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GIgRKi1w7IwWvDEHO/6kyVU/0ev+1yCIREqzQ7FAPGh3MEx4yjggEzvgx71Ys8IIth6tCi6ZEo2JyUuNCfnFog8NEXJPOF66KPo57fMwgwWXNPyNYpLEnEDRIcmpGBNfRt0xufPBM0+wRcIPLm5bCsHc20H99/FF5KXiWsvCES8= 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=eJAA8iKz; arc=none smtp.client-ip=209.85.210.46 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="eJAA8iKz" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-7e9eaf04bfaso74317a34.1 for ; Tue, 30 Jun 2026 22:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782882286; x=1783487086; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=fGkBqmWMziFZfQZQE69AV18F0fO02fbt3lLS7uXpR/w=; b=eJAA8iKzaGf8mWvFO3U3BA5FI3MPZhv73ocT9rNNmK+t1bdyO41QA/YASZVHUpvYoA zMOdynAK3JFgjmXQ95NEtc7VmZaReUBDHPSCwRMWOhWEv/JTBCI1fLbbFkIZhTC3Ci2R VP5yJk/1MZ9X7AMd8um2yO737tJGqCrDOJ7hnvAP1lJ0o+gmnmgDXGO1/K9gI1+KB+yr 7FVioCgCLJtl5Wby1p/7IF2mctUWSOISzhiMNMy6u/pjRprJszxL1jXj7t6/l70zFsx2 rEvGc0/C3p+R6i0sxvQmjiu9ZF129E+qalGFYT2gKHotzZqelImYhh7oUZf6vd6tA3zM bODQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782882286; x=1783487086; h=in-reply-to:content-disposition: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; bh=fGkBqmWMziFZfQZQE69AV18F0fO02fbt3lLS7uXpR/w=; b=fcTnTjhbvb1Fl5EJPlgYTzwZDBGLBRY5mjxM+4OgikjdAHtGooEJrMAI4SsnY6HW4Y gokFAbca92xocFNSEJabdGlDzSwWFwXm3Nz3jOxbMlYXvSrx1Cv5Ns9TwYMCNfMelGeZ kRMYvnnFfu/xN20rEmCnQ8JEWnZeCnDAWEamWxUgTw2KE3AVBufLYr6Ykwi3/T4Xv/vQ mI6wYtIe091+ibiOiJ6aEniOJK1yheF05+ez7VnFb96Zhm8+6LWbiz6GXERocICZ0teF YyK5v9vMWbh/5LTgA0uzvSwxS0KykV0my7GPutRTcyP60I/KFfqbmkIfTpglo8jicjcu 5/UQ== X-Forwarded-Encrypted: i=1; AFNElJ+2qmloUH2Cs1+XsHhvypRNbgoUpe8fXmzzXhlNfVihJ/p7KB8N5N4++H82p3NfohcPXhZ5l7yfw7OccoI=@vger.kernel.org X-Gm-Message-State: AOJu0Yyu0O1aI06iAbYeeQE5Q8s4W+DAYMlpUPLLWjAvKavKQBMM/LWj 1BIl5PZ/1nWliwrFzBIPLh6RR5IyntguTmG+1OmPr/Wf4ndpPqo38zen X-Gm-Gg: AfdE7cl33jIqyMstCHfZ/eWpCzcFQUwxSNJLg6YUpo7E9FVYeRqqNxV0BmLnkrUrLy+ AsgU7WAE/p4F4iEE833JXLPMztYsU0eoeeVDnZfQwUAD3M3KELoextJ1rtTN8t1yGW2rSghIvPk jgaV7kIw9hBBr7++UI4/ZUKONi947aoPFmoyHcp5X/iN0k9xl8argdpfdaHklOZK2NOZUlxWIs0 7b2GQ8v9ENJ6zPicCDgcACSlFYPqb3PC1Uv/fKWwj3+R0YsrWHw5eLs7ty3PKPiEuRXwajGNmTO Zd/ZagGoPhrZ/q1AdmHjMDhpc/sTWKhyl3v+EAyxgJ4qjlQ2207nGHabSr6wnLZqCdxgaAdCkF2 FnfNpVDhj71n5aSTQLwV4b60pZ4pnVZ41FpseBKJ0Ccuf463Qls+nBqrWdaGPJA+b6L3pnMTW3V LRmxMF X-Received: by 2002:a05:6830:82a4:b0:7e9:e1ec:c818 with SMTP id 46e09a7af769-7e9fc26b827mr2264128a34.25.1782882286053; Tue, 30 Jun 2026 22:04:46 -0700 (PDT) Received: from localhost ([74.80.182.83]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e9ec2e200asm3974254a34.19.2026.06.30.22.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 22:04:44 -0700 (PDT) Date: Wed, 1 Jul 2026 08:04:38 +0300 From: Dan Carpenter To: adi25charis@gmail.com Cc: vaibhav.sr@gmail.com, mgreer@animalcreek.com, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: greybus: audio: split topology get into size and data calls Message-ID: References: <20260629144941.33818-1-adi25charis@gmail.com> <20260630204908.40206-1-adi25charis@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260630204908.40206-1-adi25charis@gmail.com> On Wed, Jul 01, 2026 at 02:19:08AM +0530, adi25charis@gmail.com wrote: > From: Aditya Chari S > > gb_audio_gb_get_topology() combined three separate responsibilities > into a single call: querying the topology size, allocating a buffer > for it, and fetching the topology data into that buffer. This left > callers with no way to perform any of these steps independently, and > forced the kzalloc() allocation to live inside the protocol-layer > driver rather than the caller, as already flagged by a FIXME comment > at the call site in audio_module.c. > > Split the function into two: > > gb_audio_gb_get_topology_size() - queries only the topology size > gb_audio_gb_get_topology() - fetches topology data into a > caller-supplied buffer of a > given size > > Update the only caller, gb_audio_probe() in audio_module.c, to query > the size first, allocate the topology buffer itself, then fetch the > data into it, freeing the buffer via the existing free_topology error > path on failure. > > This resolves both the "TODO: Split into separate calls" comment > above the original function in audio_gb.c and the FIXME comment at > the call site in audio_module.c, both of which are removed as part > of this change. > > No functional change in behavior for the existing probe path. > > Compile-tested with W=1, sparse (C=2), and checkpatch.pl; all clean > on the three changed files (audio_gb.c, audio_module.c, audio_codec.h). > > Signed-off-by: Aditya Chari S > > ---------- > v2: > - Fold in review feedback from Dan Carpenter. > - Store topology size as size_t instead of u16. > - Move topology size validation into gb_audio_probe() before kzalloc(). > - Use -EINVAL for invalid topology size. > - Drop unrelated dev_err() formatting cleanup. > - Compile-tested with `make M=drivers/staging/greybus`. > - Run checkpatch.pl on the updated patch; no issues reported. > --- Thanks! Reviewed-by: Dan Carpenter regards, dan carpenter