Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5973289pxb; Mon, 14 Feb 2022 12:04:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDiw+MlHPukIfTKD/tY3lCWidjRaN4m673PYVSMFbgYt9zVt5c2+R1Z99AzcSk0kUQftHr X-Received: by 2002:a17:902:8547:: with SMTP id d7mr522960plo.126.1644869065851; Mon, 14 Feb 2022 12:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644869065; cv=none; d=google.com; s=arc-20160816; b=gc/HiQWvba22Sw4fRiRpdaRjlCHjV6IrMNw2OZs5o7CKeMtI7rRmOdOOGbRtA9nScu 4UqhABGhA+P4UrVOJqZ6rjzIx2lrhPHYCgXYqL4MHmonQy9IVGAsbkK15DTTg/6btMH9 8jn++iCmBNNDlD9XOK1YKcP/qM+eWeovAePxaCWR3PbBp6hfCzkyHRUbxm4GTeQzKPkP Ckhlw5/aS2wXrc4nqU3McVkib19V14TkSfG4N3GbRzqNlurBFffJFb2TYaOYF6E35ouo lq6b38xs19VubN9//aTFoo0DqDTYJPaJmqOQJPdU5ViVoJOeeDfCGU3fAJMBNoimUTlr c1TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pyb5tWJcRHnLtMA4aomMpy/PR66GTMIsvJog689hRGc=; b=0WreiFgQIkhAUGek6v/zGukr2S2Hgb4A/60XkPbb8sfRmH9JGlOe7MFZfJ/RvtNEGN YeGWh/j+/gyLTvAd5Wi1ofJ9cCxoAYVygGUffteGBALjxWSYPW5dqSeHG5LDrgQW2R1Q 9cWETHS+HoGqALVd95Oy1sCdxhzYfXLYKFAZjg8d29TCX7IpEt5XxBsvbn1VyCX+3etU pSKalAVFmvXOJTVTr/oS1DWLTcOWzSj9tIchnszIxaYtWOrJ+d06U/aU1PgNu58igui6 7C5MNtCWkcJbMLeihjBjjBhXODyzafdi/NuXdnS+cndWoodnkCiYvaptgeK2M+Nb4jb7 gNYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jms.id.au header.s=google header.b=kFGI58gk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 8si31555480pfm.146.2022.02.14.12.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:04:25 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@jms.id.au header.s=google header.b=kFGI58gk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 25A9BDD473; Mon, 14 Feb 2022 11:43:23 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240769AbiBNGfR (ORCPT + 99 others); Mon, 14 Feb 2022 01:35:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbiBNGfQ (ORCPT ); Mon, 14 Feb 2022 01:35:16 -0500 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B6ED56752; Sun, 13 Feb 2022 22:35:07 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id l14so14635036qtp.7; Sun, 13 Feb 2022 22:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jms.id.au; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pyb5tWJcRHnLtMA4aomMpy/PR66GTMIsvJog689hRGc=; b=kFGI58gk9L2wKQUEXFTQIbvdGcIcQo5SWS5Le+2Bz/yzMVC5mL9Te3zCOzUeI/andg R0jO0pc9xYLWZ+lp0vuQyxunwlel8M6GupgUxW/zH0nsL/hjLvSsyDDsuWkSwUzoEw8g QnHGQ55wKBkp1SdkzYlni7GuAzsLnTJWGNrSA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pyb5tWJcRHnLtMA4aomMpy/PR66GTMIsvJog689hRGc=; b=qWM2lD0FiSyjenC+hFRgn4xxKENpSyQHJGMFMSWRf7BsY6bEj8h3Q/n+SiTWfZ+V7N NNZzKF9F+Ik4wJImsHErqmzobbqY/nSq5hEmK6bEAmmlr2CBnTM//p25xV/j4jEqKJT8 6bnOr0wchajCTUmvQGq7kxBmhKy8R2GCLqEcQsKaPy1Bt2NbyU72OUbG3qRJzhT0Jaa/ isWLGJLdw08Wx9880vDWqSQqf/OKq/BZMsxZIr81kyRfGZ6yf6edD2b80nPxVBtCBt2b j+xxArrwVST2Hv7NrlXf2DSwPLC5jaWVpfvSJx3vMiSGAJaMER+lm8ZWjgJKiZ858o66 pSNQ== X-Gm-Message-State: AOAM532TQON+3EZ4uAbeY50eiVwNcu9I7iBYbRn3hwvlTm9EIqNB+CEl B9wYqGcTYljSGlccPv+c/9nhvKRqx/gWRWRQJFk= X-Received: by 2002:ac8:7e91:: with SMTP id w17mr8357451qtj.678.1644820506485; Sun, 13 Feb 2022 22:35:06 -0800 (PST) MIME-Version: 1.0 References: <20220214032708.854-1-jammy_huang@aspeedtech.com> In-Reply-To: <20220214032708.854-1-jammy_huang@aspeedtech.com> From: Joel Stanley Date: Mon, 14 Feb 2022 06:34:54 +0000 Message-ID: Subject: Re: [PATCH] media: aspeed: Use of_device_get_match_data() helper To: Jammy Huang Cc: Eddie James , Mauro Carvalho Chehab , Andrew Jeffery , linux-media@vger.kernel.org, OpenBMC Maillist , Linux ARM , linux-aspeed , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 Feb 2022 at 03:27, Jammy Huang wrote: > > Use of_device_get_match_data() to simplify the code. > > Signed-off-by: Jammy Huang > --- > drivers/media/platform/aspeed-video.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c > index 3904ded2052a..d4acf84cda9b 100644 > --- a/drivers/media/platform/aspeed-video.c > +++ b/drivers/media/platform/aspeed-video.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -2451,7 +2452,6 @@ MODULE_DEVICE_TABLE(of, aspeed_video_of_match); > static int aspeed_video_probe(struct platform_device *pdev) > { > const struct aspeed_video_config *config; > - const struct of_device_id *match; > struct aspeed_video *video; > int rc; > > @@ -2463,11 +2463,7 @@ static int aspeed_video_probe(struct platform_device *pdev) > if (IS_ERR(video->base)) > return PTR_ERR(video->base); > > - match = of_match_node(aspeed_video_of_match, pdev->dev.of_node); > - if (!match) > - return -EINVAL; > - > - config = match->data; > + config = of_device_get_match_data(&pdev->dev); While normally this driver won't have probed without matching on some data, it would be sensible to add a check for a null pointer here. > video->version = config->version; > video->jpeg_mode = config->jpeg_mode; > video->comp_size_read = config->comp_size_read; > -- > 2.25.1 >