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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC27AC433F5 for ; Wed, 22 Sep 2021 16:45:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9381560F70 for ; Wed, 22 Sep 2021 16:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236568AbhIVQrE (ORCPT ); Wed, 22 Sep 2021 12:47:04 -0400 Received: from gloria.sntech.de ([185.11.138.130]:50984 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229467AbhIVQrD (ORCPT ); Wed, 22 Sep 2021 12:47:03 -0400 Received: from ip5f5a6e92.dynamic.kabel-deutschland.de ([95.90.110.146] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mT5N7-0001Oz-HF; Wed, 22 Sep 2021 18:45:25 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Colin King , Sandy Huang , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Alex Bee Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] drm/rockchip: Remove redundant assignment of pointer connector Date: Wed, 22 Sep 2021 18:45:24 +0200 Message-ID: <22365175.EbdSka62eY@diego> In-Reply-To: <27c79f7a-8e4c-fad8-c6cf-a89793f2e3c6@gmail.com> References: <20210922112416.182134-1-colin.king@canonical.com> <27c79f7a-8e4c-fad8-c6cf-a89793f2e3c6@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, Am Mittwoch, 22. September 2021, 18:35:38 CEST schrieb Alex Bee: > Hi Colin, > Am 22.09.21 um 13:24 schrieb Colin King: > > From: Colin Ian King > > > > The pointer connector is being assigned a value that is never > > read, it is being updated immediately afterwards. The assignment > > is redundant and can be removed. > > The pointer to the connector is used in rockchip_rgb_fini for > drm_connector_cleanup. > It's pretty much the same for the encoder, btw. I think the issue is more the two lines connector = &rgb->connector; connector = drm_bridge_connector_init(rgb->drm_dev, encoder); hence the connector = &rgb->connector being overwritten immediately after Now that I look at it again, the whole approach looks strange. drm_bridge_connector_init() creates the connector structure and returns a pointer to it. So the first line below sets the connector pointer to point to the &rgb->connector element and the second line then set a completely different address into it. So the connector element in rockchip_lvds and rockchip_rgb should actually become a pointer itself to hold the connector element returned from drm_bridge_connector_init() . Heiko > > Regards, > > Alex > > > > Addresses-Coverity: ("Unused value") > > Signed-off-by: Colin Ian King > > --- > > drivers/gpu/drm/rockchip/rockchip_rgb.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c > > index 09be9678f2bd..18fb84068a64 100644 > > --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c > > +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c > > @@ -150,7 +150,6 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, > > if (ret) > > goto err_free_encoder; > > > > - connector = &rgb->connector; > > connector = drm_bridge_connector_init(rgb->drm_dev, encoder); > > if (IS_ERR(connector)) { > > DRM_DEV_ERROR(drm_dev->dev, > > > >