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 0B032C433EF for ; Mon, 14 Feb 2022 08:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240249AbiBNIGB (ORCPT ); Mon, 14 Feb 2022 03:06:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiBNIF6 (ORCPT ); Mon, 14 Feb 2022 03:05:58 -0500 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E4D5C378 for ; Mon, 14 Feb 2022 00:05:50 -0800 (PST) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 21E7vG2C063896; Mon, 14 Feb 2022 15:57:16 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from [192.168.2.115] (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 14 Feb 2022 16:05:44 +0800 Message-ID: Date: Mon, 14 Feb 2022 16:05:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] media: aspeed: Use of_device_get_match_data() helper Content-Language: en-US To: Joel Stanley CC: Eddie James , Mauro Carvalho Chehab , Andrew Jeffery , "linux-media@vger.kernel.org" , OpenBMC Maillist , Linux ARM , linux-aspeed , Linux Kernel Mailing List References: <20220214032708.854-1-jammy_huang@aspeedtech.com> From: Jammy Huang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 21E7vG2C063896 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joel, On 2022/2/14 下午 02:34, Joel Stanley wrote: > 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. OK, I will have a updated patch for this later. Thanks for the help. >> video->version = config->version; >> video->jpeg_mode = config->jpeg_mode; >> video->comp_size_read = config->comp_size_read; >> -- >> 2.25.1 >> -- Best Regards Jammy