From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D66EB10F0; Wed, 20 Apr 2022 07:50:53 +0000 (UTC) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 77443240002; Wed, 20 Apr 2022 07:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650441045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zk0UJgX+zS8uYCmoLn7JkGQ+qKIowqpPLy9PBUXizmI=; b=ls8Cn19nbxV/9ffObyyoOzrBODoj+hI7TxwVZbwu4IgkYriEXLB/U3GUAIGKJF43uH9pNe sRVMBO2e5Mvd4RJH93WFex2LBr6VQNSWbwaUXg36/saJtxRei+pWEcAs4XW6I4rpdTy7wz IOMtkZv7IrDPYfzE5b9BbHQyhazCJVdszKOC3Gk+tOqoxL9QcTpV0/Wf9dHBRSfNm0l0v5 XnhYsnNmrR7Qa1LPpVKoi77DAdkRE3ueVDNSOd/koZI5gk4RLJKfZeX2rqilSGMsu74y+T KcOxrvecpZYIHIMudzwTMzT3vAgb8p5K3/Y4gkW1zlyjGqKmFCtqARkiRajqtQ== Date: Wed, 20 Apr 2022 09:50:42 +0200 From: Paul Kocialkowski To: Dan Carpenter Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: Re: [PATCH v3 3/4] staging: media: Add support for the Allwinner A31 ISP Message-ID: References: <20220415153708.637804-1-paul.kocialkowski@bootlin.com> <20220415153708.637804-4-paul.kocialkowski@bootlin.com> <20220420074249.GB2951@kadam> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VYpzucMrXezC+iN2" Content-Disposition: inline In-Reply-To: <20220420074249.GB2951@kadam> --VYpzucMrXezC+iN2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Dan, On Wed 20 Apr 22, 10:42, Dan Carpenter wrote: > I ran Smatch on this patch. Thanks for doing this! > On Fri, Apr 15, 2022 at 05:37:07PM +0200, Paul Kocialkowski wrote: > > +void sun6i_isp_capture_configure(struct sun6i_isp_device *isp_dev) > > +{ > > + unsigned int width, height; > > + unsigned int stride_luma, stride_chroma =3D 0; > > + unsigned int stride_luma_div4, stride_chroma_div4; > > + const struct sun6i_isp_capture_format *format; > > + const struct v4l2_format_info *info; > > + u32 pixelformat; > > + > > + sun6i_isp_capture_dimensions(isp_dev, &width, &height); > > + sun6i_isp_capture_format(isp_dev, &pixelformat); > > + > > + format =3D sun6i_isp_capture_format_find(pixelformat); > > + if (WARN_ON(!format)) > > + return; > > + > > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_SIZE_CFG_REG, > > + SUN6I_ISP_MCH_SIZE_CFG_WIDTH(width) | > > + SUN6I_ISP_MCH_SIZE_CFG_HEIGHT(height)); > > + > > + info =3D v4l2_format_info(pixelformat); > > + if (WARN_ON(!info)) > > + return; > > + > > + stride_luma =3D width * info->bpp[0]; > > + stride_luma_div4 =3D DIV_ROUND_UP(stride_luma, 4); > > + > > + if (info->comp_planes > 1) { > > + stride_chroma =3D width * info->bpp[1] / info->hdiv; > > + stride_chroma_div4 =3D DIV_ROUND_UP(stride_chroma, 4); >=20 > stride_chroma_div4 is not intialized on the else path. One could say it's not an issue to put an uninitialized value in this situa= tion since the hardware won't be taking it into account but I'll initialize the = value early in the next iteration. > > + } > > + > > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_CFG_REG, > > + SUN6I_ISP_MCH_CFG_EN | > > + SUN6I_ISP_MCH_CFG_OUTPUT_FMT(format->output_format) | > > + SUN6I_ISP_MCH_CFG_STRIDE_Y_DIV4(stride_luma_div4) | > > + SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4(stride_chroma_div4)); > > +} >=20 > [ snip ] >=20 > > +void sun6i_isp_params_configure(struct sun6i_isp_device *isp_dev) > > +{ > > + struct sun6i_isp_params_state *state =3D &isp_dev->params.state; > > + unsigned long flags; > > + > > + spin_lock_irqsave(&state->lock, flags); > > + > > + sun6i_isp_params_configure_base(isp_dev); > > + > > + /* Default config is only applied at the very first stream start. */ > > + if (state->configured) > > + goto complete; > > + > > + sun6i_isp_params_configure_modules(isp_dev, > ^ > There is an extra space character here. Good catch, thanks! > > + &sun6i_isp_params_config_default); > > + > > + state->configured =3D true; > > + > > +complete: > > + spin_unlock_irqrestore(&state->lock, flags); > > +} Cheers, Paul --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --VYpzucMrXezC+iN2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmJfu1EACgkQ3cLmz3+f v9GROggAhvf/IrRIYswrCnaCpPLhkw4Ly73/iOp4HatHnslaoOnc2CK8KfD2bYxv SoNYxaxuY8pKUmTtGNOoeX4rj1MeOR5TeDPqNOJHYScFZb94ap3UveCyh+AzROnY n/pbj6zBGJPjxjpV+epd5LgJId+r09yM3EAlYN5Fnuz5ot9urfLXSZIUo2XJGQQs tBkdjG5hnqX+SgMsdMlAHSzpXA41J1Y2vLB2ngIRh2/j4fdid+65+9JlgNOYKfBo d6HNp6QXAsQOhdTFzJaA2aXK3h54cxt5I0Wmhsi3uHe2bQLungevWyCPnYKvaZo7 PoBqL/Y9x73xyEIjCFcQwp8aT6rpJA== =Vq1E -----END PGP SIGNATURE----- --VYpzucMrXezC+iN2-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33D8FC433F5 for ; Wed, 20 Apr 2022 07:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YdRzeo4vPLIAJ/CCzZECeItbPA/QwjmT2AiJKxkA6hY=; b=ulhxuBdnEYU+0Bb5KATBP8TByz 57DiuxLpO/gzK/SWbdD88B7SSa2s6Yad7in0EnvSHvRv7mcvVSVlfDPFRXdgWlDEjg+3ctC6DpNUY C1w8FPe7STK2ehBKS1mq930vDkvjjJDBrGwsfM5iOUYVvODUqB8wMwJh6/O/9BUmT64vO3awj9W+I gtY7NggWU9pZ1ZYtkcNltAWFb9i60kyJI3BkrOVkvXcOL0rsARXGnlHc8kd8IVY1eMJtggHBbkrLP lbWHOgLNZWT/Pfuh0p+zVM23BqaZYM9HwJhLzbtYoHD82R3VWaUslhTOlYf7ubIC/HpE2PCP3Usxa 8xq5/bCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nh59r-007uyq-A3; Wed, 20 Apr 2022 07:53:52 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nh56w-007tk6-Gf for linux-arm-kernel@lists.infradead.org; Wed, 20 Apr 2022 07:50:52 +0000 Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 77443240002; Wed, 20 Apr 2022 07:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650441045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zk0UJgX+zS8uYCmoLn7JkGQ+qKIowqpPLy9PBUXizmI=; b=ls8Cn19nbxV/9ffObyyoOzrBODoj+hI7TxwVZbwu4IgkYriEXLB/U3GUAIGKJF43uH9pNe sRVMBO2e5Mvd4RJH93WFex2LBr6VQNSWbwaUXg36/saJtxRei+pWEcAs4XW6I4rpdTy7wz IOMtkZv7IrDPYfzE5b9BbHQyhazCJVdszKOC3Gk+tOqoxL9QcTpV0/Wf9dHBRSfNm0l0v5 XnhYsnNmrR7Qa1LPpVKoi77DAdkRE3ueVDNSOd/koZI5gk4RLJKfZeX2rqilSGMsu74y+T KcOxrvecpZYIHIMudzwTMzT3vAgb8p5K3/Y4gkW1zlyjGqKmFCtqARkiRajqtQ== Date: Wed, 20 Apr 2022 09:50:42 +0200 From: Paul Kocialkowski To: Dan Carpenter Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Sakari Ailus , Hans Verkuil , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: Re: [PATCH v3 3/4] staging: media: Add support for the Allwinner A31 ISP Message-ID: References: <20220415153708.637804-1-paul.kocialkowski@bootlin.com> <20220415153708.637804-4-paul.kocialkowski@bootlin.com> <20220420074249.GB2951@kadam> MIME-Version: 1.0 In-Reply-To: <20220420074249.GB2951@kadam> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220420_005050_881082_C7CD8D7B X-CRM114-Status: GOOD ( 20.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1572847511973631545==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============1572847511973631545== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VYpzucMrXezC+iN2" Content-Disposition: inline --VYpzucMrXezC+iN2 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Dan, On Wed 20 Apr 22, 10:42, Dan Carpenter wrote: > I ran Smatch on this patch. Thanks for doing this! > On Fri, Apr 15, 2022 at 05:37:07PM +0200, Paul Kocialkowski wrote: > > +void sun6i_isp_capture_configure(struct sun6i_isp_device *isp_dev) > > +{ > > + unsigned int width, height; > > + unsigned int stride_luma, stride_chroma =3D 0; > > + unsigned int stride_luma_div4, stride_chroma_div4; > > + const struct sun6i_isp_capture_format *format; > > + const struct v4l2_format_info *info; > > + u32 pixelformat; > > + > > + sun6i_isp_capture_dimensions(isp_dev, &width, &height); > > + sun6i_isp_capture_format(isp_dev, &pixelformat); > > + > > + format =3D sun6i_isp_capture_format_find(pixelformat); > > + if (WARN_ON(!format)) > > + return; > > + > > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_SIZE_CFG_REG, > > + SUN6I_ISP_MCH_SIZE_CFG_WIDTH(width) | > > + SUN6I_ISP_MCH_SIZE_CFG_HEIGHT(height)); > > + > > + info =3D v4l2_format_info(pixelformat); > > + if (WARN_ON(!info)) > > + return; > > + > > + stride_luma =3D width * info->bpp[0]; > > + stride_luma_div4 =3D DIV_ROUND_UP(stride_luma, 4); > > + > > + if (info->comp_planes > 1) { > > + stride_chroma =3D width * info->bpp[1] / info->hdiv; > > + stride_chroma_div4 =3D DIV_ROUND_UP(stride_chroma, 4); >=20 > stride_chroma_div4 is not intialized on the else path. One could say it's not an issue to put an uninitialized value in this situa= tion since the hardware won't be taking it into account but I'll initialize the = value early in the next iteration. > > + } > > + > > + sun6i_isp_load_write(isp_dev, SUN6I_ISP_MCH_CFG_REG, > > + SUN6I_ISP_MCH_CFG_EN | > > + SUN6I_ISP_MCH_CFG_OUTPUT_FMT(format->output_format) | > > + SUN6I_ISP_MCH_CFG_STRIDE_Y_DIV4(stride_luma_div4) | > > + SUN6I_ISP_MCH_CFG_STRIDE_UV_DIV4(stride_chroma_div4)); > > +} >=20 > [ snip ] >=20 > > +void sun6i_isp_params_configure(struct sun6i_isp_device *isp_dev) > > +{ > > + struct sun6i_isp_params_state *state =3D &isp_dev->params.state; > > + unsigned long flags; > > + > > + spin_lock_irqsave(&state->lock, flags); > > + > > + sun6i_isp_params_configure_base(isp_dev); > > + > > + /* Default config is only applied at the very first stream start. */ > > + if (state->configured) > > + goto complete; > > + > > + sun6i_isp_params_configure_modules(isp_dev, > ^ > There is an extra space character here. Good catch, thanks! > > + &sun6i_isp_params_config_default); > > + > > + state->configured =3D true; > > + > > +complete: > > + spin_unlock_irqrestore(&state->lock, flags); > > +} Cheers, Paul --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --VYpzucMrXezC+iN2 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmJfu1EACgkQ3cLmz3+f v9GROggAhvf/IrRIYswrCnaCpPLhkw4Ly73/iOp4HatHnslaoOnc2CK8KfD2bYxv SoNYxaxuY8pKUmTtGNOoeX4rj1MeOR5TeDPqNOJHYScFZb94ap3UveCyh+AzROnY n/pbj6zBGJPjxjpV+epd5LgJId+r09yM3EAlYN5Fnuz5ot9urfLXSZIUo2XJGQQs tBkdjG5hnqX+SgMsdMlAHSzpXA41J1Y2vLB2ngIRh2/j4fdid+65+9JlgNOYKfBo d6HNp6QXAsQOhdTFzJaA2aXK3h54cxt5I0Wmhsi3uHe2bQLungevWyCPnYKvaZo7 PoBqL/Y9x73xyEIjCFcQwp8aT6rpJA== =Vq1E -----END PGP SIGNATURE----- --VYpzucMrXezC+iN2-- --===============1572847511973631545== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============1572847511973631545==--