Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3180295pxk; Mon, 7 Sep 2020 05:42:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrnBDj2CotWfsieakI1CK6ffI0BoVUupv/nDBjapQwkhs8yIfKQ4sMWclL34qSABD0+xv+ X-Received: by 2002:a17:906:3993:: with SMTP id h19mr21380400eje.111.1599482547776; Mon, 07 Sep 2020 05:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599482547; cv=none; d=google.com; s=arc-20160816; b=MvVDOS1lRC0EUOKlg2mw50xKclZnx7LQ7FVoR3i5Sl1MFnoYrHlD1P2y5NZXRb82S5 /kuHRdASFyXSxQLv9KPuoM84V9QXTViz58n/huNFi84ppPVKoLPhaZNKVJysqU4w5cLS Iw9JVU3TByhNVlMWx+9YWnh/yoyn581w0cGbEE5/leTDt8STyzO4H4qSyusPeFAFoWqv SVmToZpfNfh7vS8NBzMx3N6xxTvjjBYF5YLTdzdQ6s/mCPu7s9McUYJ5JFs/KfqZlbPd OqJXFU6AeLe6NUy1zJ6hA3WN/wYqcsGN2upLZBfzPtIi9bjxdMievhtPTrxlTqbKszuz oU+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=n750MuAW6v7uSf61tf7HxDsoYV10btBJYGS+Y2zQ2Pw=; b=aaJDMrxF/TDiCZ6H8e15TxIlB6+JITCgh77NVM8zZCVmxvjeE5l2qW9GaFnyrLE3JE UAR4uIT8w5e0GkprztTsdqb6i2qEfOjuvu7zovTPmPuGZEcgMmEwa7RzXOmeg8H8QTnc 5SZb2aEsxu41CVJiFNQ9yJaPmtaxFCcjImyhqI03YRuNMTetmdlhtLdWkHTyo4FneJVO goJMSN/bV6M+IC+3DMYjUQusSDFuZ1MfEZqZkz58XjhVva9Tdnd1hbuzX2TlUNsFdA1Y ydMwRKXWTY9g0id5ndPdZynzBuboG2VGxDLfFhtwzzLTC19ZUxLEVn+xbu7zCNOWJWdq OquQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si5542300ejr.206.2020.09.07.05.42.04; Mon, 07 Sep 2020 05:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729238AbgIGMiF (ORCPT + 99 others); Mon, 7 Sep 2020 08:38:05 -0400 Received: from mail-m17613.qiye.163.com ([59.111.176.13]:22820 "EHLO mail-m17613.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729155AbgIGMcZ (ORCPT ); Mon, 7 Sep 2020 08:32:25 -0400 Received: from ubuntu.localdomain (unknown [157.0.31.125]) by mail-m17613.qiye.163.com (Hmail) with ESMTPA id 8CED0482A30; Mon, 7 Sep 2020 20:31:37 +0800 (CST) From: Bernard Zhao To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Bernard Zhao Subject: [PATCH] gpu/drm: cleanup coding style a bit Date: Mon, 7 Sep 2020 05:31:29 -0700 Message-Id: <20200907123129.27905-1-bernard@vivo.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgYFAkeWUFZS1VLWVdZKFlBSE83V1ktWUFJV1kPCR oVCBIfWUFZT0xMQkkfGBhJThpPVkpOQkJPQ0pDQkxMSU1VEwETFhoSFyQUDg9ZV1kWGg8SFR0UWU FZT0tIVUpKS0hKQ1VKS0tZBg++ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6K1E6Fio4Ij8tGhgpMjwyVjUt DUoKFD1VSlVKTkJCT0NKQ0JDSk1NVTMWGhIXVRkeCRUaCR87DRINFFUYFBZFWVdZEgtZQVlKTkxV S1VISlVKSU5ZV1kIAVlBSU1ITjcG X-HM-Tid: 0a74688ce2f893bakuws8ced0482a30 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove first assignment to info which is meaningless. Put the width and higth check first. This change is to make the code a bit readable. Signed-off-by: Bernard Zhao --- drivers/gpu/drm/drm_framebuffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index df656366a530..2f5b0c2bb0fe 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -176,8 +176,7 @@ static int framebuffer_check(struct drm_device *dev, int i; /* check if the format is supported at all */ - info = __drm_format_info(r->pixel_format); - if (!info) { + if (!__drm_format_info(r->pixel_format)) { struct drm_format_name_buf format_name; DRM_DEBUG_KMS("bad framebuffer format %s\n", @@ -186,9 +185,6 @@ static int framebuffer_check(struct drm_device *dev, return -EINVAL; } - /* now let the driver pick its own format info */ - info = drm_get_format_info(dev, r); - if (r->width == 0) { DRM_DEBUG_KMS("bad framebuffer width %u\n", r->width); return -EINVAL; @@ -199,6 +195,9 @@ static int framebuffer_check(struct drm_device *dev, return -EINVAL; } + /* now let the driver pick its own format info */ + info = drm_get_format_info(dev, r); + for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); -- 2.28.0