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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACA1BC433FE for ; Wed, 20 Apr 2022 07:51:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376480AbiDTHyY (ORCPT ); Wed, 20 Apr 2022 03:54:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376452AbiDTHxz (ORCPT ); Wed, 20 Apr 2022 03:53:55 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 741673BFB8; Wed, 20 Apr 2022 00:50:47 -0700 (PDT) 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 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VYpzucMrXezC+iN2" Content-Disposition: inline In-Reply-To: <20220420074249.GB2951@kadam> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org --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--