From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 EC450401A26 for ; Wed, 6 May 2026 10:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778062581; cv=none; b=PzwcqS/I3CY0YAE4F35TLdfQh9PKAjaF5BsDHhf0MAOgk1Cu8VQBCeHSWsZNnTUsVIMx5/tw26esNee4ZFh4FU+x8dSnBxiYZKetCNgvQ0irBJwUo3/QrxNdlE9B3FxVB1kSoo7WtyPlTogh5pYdO9ib0XHJR6xjdPOsILCftpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778062581; c=relaxed/simple; bh=XHAbCn/groQfldwxdeD5Eyl+5lyhV01Ox5pQ7n8CcYg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=A3dEQGd3D2UCZNJuTxWFvcY3LrJMevX6Hxf4M8aylYo8OPpx9XfBxt9PM5erDfswn2usWknvixMz7htS/uki/0QJSDwf+j6sAoU8F3Xui8r1Slo0LS+GYABqOUWFwmrfk9G5AuCYdnQKdtE7h443+qNT9hTp02s4H1rNf7tgdZ4= 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=cAMIPBph; arc=none smtp.client-ip=209.85.221.51 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="cAMIPBph" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-44b330c5cc6so3104051f8f.1 for ; Wed, 06 May 2026 03:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778062575; x=1778667375; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MP5zUKceXITgWBoyT5sfmWgOMBr2j3wdzx/KXPcZhWU=; b=cAMIPBphJHWJxDFDTWPUXNVXs0VWMNEXBeuA7JOHOKXe9hJMJy0IQtO6680AnEHH7j Tvb3In1d4aF/qGkx5t7cchChhQoby6y5wsXmdThsRSRI7C9P0F25ihjokCohMVOLFcPw aFZ9Kuq3se+nFO5vpkm2CnYbygvlQpjtpG7/uTYCJ+bszzzTY+OMyJXsvQwrMF1LfI0w hjG18jwO33PEH7yPHFQc41PzYN1/pSgbfFZXgWQU+lSuUALSf7+t08orkdMTuAObbcH2 u43LPRazt8rzNkawTIRq8qfcq208P2uK22dFtRRS24KjoVSSPEq+Cyflryxhekbz8gEv EEnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778062575; x=1778667375; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MP5zUKceXITgWBoyT5sfmWgOMBr2j3wdzx/KXPcZhWU=; b=S9uTVAsrS2cMM+7o9BkafJngo1o0ymo0L0Raqd0JYhhvwrZPcrR2JwGZOsu1B5jm37 xJJYVQ2vEfJ+VCr/QTFtm1tV2XnKzCFAGeMKkXBsnPxAqlZMQ+V4uVse+uPZnMFexioJ 0THSZzkx0Ooj3iQYzaw8K2eZ1FsBtv1Uzyan8qaUXZnB2EHUdSif/uljrHyk3l/Qnsf5 HjbNpvMomzzJibrWpW6PjpGGYdCbnQW8LaQ/xrrO9YS8FTQMaLIL+iNkdyyuRxkwmZXn 388H9w/GGv2YJneT2ZWxLV9GwzVrIcXb6YmzKIW20UFk5FmpMvAbKs1KC0PspvvLcN2d CCXw== X-Forwarded-Encrypted: i=1; AFNElJ9AKyYHUDwKX+mTtSP9JCFkMJ7giJqPD4EAXpPs+LsUaBb6je5DzVR/cRwXD1NEkOn1NahUoRqCS3VNZGk=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7qJ2YREiA4inzeuZfGgRoXwZHELF7e5BPrLE0ycg8VGqKyb17 Fj/smdKqkeCjZnocMut2gw+BDxvioLZAFqxkCaKorEXjT5U2bSlX7OLm X-Gm-Gg: AeBDieuZZoGqXAwpWeVw5+jC3rTSBQJAbF58Pi2scokL2ODywoot5kpeaAuic+e6CpH Z6u2PfaV/cLCdLh8GPYCTUg19jmBuX7mgPTcKbnrla627YvVITtou0dM33vt0eT4BS5/yflmF8K Ho39+0+1lgKtEBR08Gz/OXWlc+J2cUwk4ZmmFZZuqyqhuJh0u9ILwV7ME+uJWUcTSCp3TEmCBQC PsIau6DoLOlnubK58EJKUF9i+OUFT/RRmKxtdpYiJIEvdYrRsAmri8r+wWRFRn/lgs7oJ+F0d3a o0QxL8sJ1xKATqnUHGE+lh6e6GMVXYxxHHEl1Et9iEZj/WDJbVXzCDDVAgCbBcGJDNxY427a7k+ Y5mqtGuRYNWAJwSF+0/H2v6NFe1bnFxsyzFqrr2B1pZJ8C1HDPNlDYC0GYbFUFYT+3QEk9hfNqc e0XDE4xsHqRjogEvvDaOW67FtHHhU3qeKlQV+iFYpbUhDbS/nyA6qHwsN7NCDXgaT/IXijCK8Je HcmL1Vz X-Received: by 2002:a05:6000:2681:b0:441:1e41:194 with SMTP id ffacd0b85a97d-4515b525426mr4784852f8f.17.1778062575284; Wed, 06 May 2026 03:16:15 -0700 (PDT) Received: from ?IPV6:2a02:8109:8617:d700:a1d:902c:85c8:d272? ([2a02:8109:8617:d700:a1d:902c:85c8:d272]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4504f4857ffsm11043763f8f.0.2026.05.06.03.16.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2026 03:16:14 -0700 (PDT) Message-ID: <37aa90a3-7909-4605-a0be-1545db1fadb0@gmail.com> Date: Wed, 6 May 2026 12:16:13 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] media: i2c: alvium: Fix controls for WB/AWB To: Sakari Ailus Cc: martin.hecht@avnet.eu, michael.roeder@avnet.eu, stable@vger.kernel.org, Tommaso Merciai , Mauro Carvalho Chehab , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260505142513.1551721-1-mhecht73@gmail.com> Content-Language: en-US From: Martin Hecht In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Sakari, thank you for the comments. On 5/6/26 11:28, Sakari Ailus wrote: > Hi Martin, > > Thanks for the patch. > > On Tue, May 05, 2026 at 04:25:10PM +0200, Martin Hecht wrote: >> With that patch the controls for red-balance and blue-balance were created >> only if the particular camera supports that. Otherwise the pointers on >> the control variable are initialized with NULL to prevent side effects for >> clustering with AWB control. >> >> Fixes: 0a7af872915e ("media: i2c: Add support for alvium camera") >> Signed-off-by: Martin Hecht >> --- >> drivers/media/i2c/alvium-csi2.c | 37 ++++++++++++++++++++------------- >> 1 file changed, 22 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c >> index b62b45a4f2fc..4c6934e9e177 100644 >> --- a/drivers/media/i2c/alvium-csi2.c >> +++ b/drivers/media/i2c/alvium-csi2.c >> @@ -2108,26 +2108,33 @@ static int alvium_ctrl_init(struct alvium_dev *alvium) >> 0, 0, &alvium->link_freq); >> ctrls->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; > > This is a problem. Can you move setting the flags after checking the > handler's error status? The functions adding controls may fail and this is > simply a missing error check. > > Can you submit a fix, with a Fixes: tag and this patch should be rebased on > the fix, please? I'm preparing a separate fix for that issue. It's the same situation also for some other controls like pixel_rate and link_frequency but not only. Can I combine that into one patch for fix only that in alvium_ctrl_init? > >> >> + if (alvium->avail_ft.whiteb) { >> + ctrls->blue_balance = v4l2_ctrl_new_std(hdl, ops, >> + V4L2_CID_BLUE_BALANCE, >> + alvium->min_bbalance, >> + alvium->max_bbalance, >> + alvium->inc_bbalance, >> + alvium->dft_bbalance); >> + ctrls->red_balance = v4l2_ctrl_new_std(hdl, ops, >> + V4L2_CID_RED_BALANCE, >> + alvium->min_rbalance, >> + alvium->max_rbalance, >> + alvium->inc_rbalance, >> + alvium->dft_rbalance); >> + } else { >> + /* set to NULL for v4l2_ctrl_auto_cluster if not existing */ >> + ctrls->blue_balance = NULL; >> + ctrls->red_balance = NULL; > > Aren't the two NULL already before this? You are right. It's zeroed before because __GFP_ZERO in devm_kzalloc. Will remove that redundant code. > >> + } >> + >> /* Auto/manual white balance */ >> if (alvium->avail_ft.auto_whiteb) { >> ctrls->auto_wb = v4l2_ctrl_new_std(hdl, ops, >> V4L2_CID_AUTO_WHITE_BALANCE, >> 0, 1, 1, 1); >> - v4l2_ctrl_auto_cluster(3, &ctrls->auto_wb, 0, false); >> - } >> - >> - ctrls->blue_balance = v4l2_ctrl_new_std(hdl, ops, >> - V4L2_CID_BLUE_BALANCE, >> - alvium->min_bbalance, >> - alvium->max_bbalance, >> - alvium->inc_bbalance, >> - alvium->dft_bbalance); >> - ctrls->red_balance = v4l2_ctrl_new_std(hdl, ops, >> - V4L2_CID_RED_BALANCE, >> - alvium->min_rbalance, >> - alvium->max_rbalance, >> - alvium->inc_rbalance, >> - alvium->dft_rbalance); >> + >> + v4l2_ctrl_auto_cluster(3, &ctrls->auto_wb, 0, true); >> + } >> >> /* Auto/manual exposure */ >> if (alvium->avail_ft.auto_exp) { > BR Martin