Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3401456pxk; Mon, 7 Sep 2020 11:49:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx89p9va3EBDNXpGlOdcv5JmTutGkDSNvWuI99qLHCXIiqr92OSIJh6XNDSdySfjDjFYB5p X-Received: by 2002:a50:bf47:: with SMTP id g7mr4149912edk.26.1599504561311; Mon, 07 Sep 2020 11:49:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599504561; cv=none; d=google.com; s=arc-20160816; b=QQqku8kVUeA7coy8C6tU46LUwfj+8a/aH1geiXgNqcfOiClUfP9aNKTPu/UFhjxcPI yBQmUxper3qETRJR8eB+bHXs9FlusA1gEAZW83E48tMgMyZvvieKpBAVSFDsXfJWxjyb 9DFFEWRV4l4OenJsiywkxVOaSPseHv4ueHpc9bjAMqJZWZzPprqpzITxfpQHjYWRMO8j CYMoXZ4l3HySMbCAUt4kWsz0+1GFBTV4L880WRY2r0afkpfjsna241FgMu7rgbluBq/q 5U5AqS86aYPZrWdLEX87HkPzlPNbAEZEhrSdlMTvVoCzQIP2KxJa44FASUoBIWfm/4/W fniQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=QAr1+0ipkVpkx5YO9BIZ97gdBS2//wH3zq/vWYPLIrs=; b=fKW+WuoqhprpzdC6xJE0iekVoR9r5hLq6tHGWk/RI2Z/WsmxUrmOVrzCqRoWw/41hF ByWhCQ/vjjasulnhtBTMPHnnQ/3o6bMtk+LGHCUkrCzx26oKxssgTXPcGe6Kr+sw95cS ba09XUVJqk/AXNxA6NxN0BZz3cnhtYGVBJ0FF4eUUOfWXvFcpAGF/UHWDKfK1YMwcjyP YlLAvnzG7YVGK/6aK9sVcZkuqKuAhtp0LFBn23JacXWBgTHRBpWwY1atrBm2lzB25Qrx qyyvySqSgxjQWYooWmj4+Kw+OEXhJCm/88xMn7DgGrvEsQ3ehKnICn+2KNM786t7AE3L NoLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=gI316Jq4; 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 r19si7297005ejr.560.2020.09.07.11.48.42; Mon, 07 Sep 2020 11:49:21 -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; dkim=pass header.i=@ffwll.ch header.s=google header.b=gI316Jq4; 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 S1729577AbgIGSRL (ORCPT + 99 others); Mon, 7 Sep 2020 14:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbgIGSRH (ORCPT ); Mon, 7 Sep 2020 14:17:07 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 336BEC061573 for ; Mon, 7 Sep 2020 11:17:07 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id j2so16653303wrx.7 for ; Mon, 07 Sep 2020 11:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=QAr1+0ipkVpkx5YO9BIZ97gdBS2//wH3zq/vWYPLIrs=; b=gI316Jq405Je2kwl9Dqk5oa+2uA8CtINsqRrQuzjeGDqNKqWJDnhaYrBjv04KRh5+r xzDWk/7Jj7r5+ew40cblbmARBwPs/aiUBtea76zjl1e5UEXCJJvLaq/grvlq7zijQiwW r8bHEPmG1AIVOklW4efeRnB9Ft1R9JZAinI2U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=QAr1+0ipkVpkx5YO9BIZ97gdBS2//wH3zq/vWYPLIrs=; b=Ac72dijI588Cx2Ya/Q6jUAysKbPN1FviB0pwjxOPpwBu/X33bvaYMy5IhZAjUHVy0r rcuB+55cBy011sCpWW9baP9C8J6yg/Q6d5EpiN6JMcV9G6lhgJuFYSvUBhNl71HfeSjH dHGx0YVIAsWgSQ5CSwQVLUn6yD9zCS9KmExASpKensX+LAAay6FOcOYbmrBHGYJsaXN7 PJmNT0WUR7ba0e24scF++32OBSQMH8fblkF9BnjyOWZf1CcPs6C3XsRCwq9wZ1+Zv6gb Y9IIHO49FU0S/oWTffJUjJ3+IL5iElTUfjozWuv027lwRzEQO3eNZ7sXsBU51FGxrAAH nSJg== X-Gm-Message-State: AOAM533Qxco94yeK/bqs7cFwHIav2wzF6wrY6xfPHh8j25MlN5cZWRgt jBXyWRF2SMe0EZMLGW6rpz7+dA== X-Received: by 2002:adf:fa0c:: with SMTP id m12mr22363209wrr.406.1599502625885; Mon, 07 Sep 2020 11:17:05 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id c145sm26200523wmd.7.2020.09.07.11.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:17:05 -0700 (PDT) Date: Mon, 7 Sep 2020 20:17:03 +0200 From: Daniel Vetter To: Bernard Zhao Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com Subject: Re: [PATCH] gpu/drm: cleanup coding style a bit Message-ID: <20200907181703.GD2352366@phenom.ffwll.local> Mail-Followup-To: Bernard Zhao , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com References: <20200907123129.27905-1-bernard@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200907123129.27905-1-bernard@vivo.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 07, 2020 at 05:31:29AM -0700, Bernard Zhao wrote: > 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 Looks reasonable, thanks for your patch. Applied to drm-misc-next for 5.10. -Daniel > --- > 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 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch