Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5545804pxb; Mon, 14 Feb 2022 01:28:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxbYz8Gml4aMq24yBVnRTw9vKJEunTkkOF7k6R5LKeAm3LPv1B3tos0U8iHX/tXhvroTnpi X-Received: by 2002:a17:902:ec83:: with SMTP id x3mr10598302plg.170.1644830918102; Mon, 14 Feb 2022 01:28:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644830918; cv=none; d=google.com; s=arc-20160816; b=qtRRlousxqiApoDGr0gfzjfbBCgfb5lPgywkFuygQlp/UknOzFZkFEczXFo+Hz0kj0 1YP4yBqiKV/Y48N0FCnFZS+S3WeQDXMtixE8pgJergK3UBtQDwd8b++9sP7cOSgo4Ud/ T9+0rL5D3AJrbFZhiJ2rrIhEn/XEYuoVl3sfA2X23/rpJDrbLyFbaQpTs4MNCcFaNcq9 tJrGvuQkfsexA543qB2aSmJFmZ1FT1geSWKaCfX3/ZZ3cx3xWiT6MRbZ5WxsRylLuM6O gWHl/6sNdBXIUGCFBKkFY2+6eo06AaT9w8URIqiFgpxBhsTHxLMpfbN8UgKMWKKCJ/zS vHRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=nh8sPoFa6BnBk0dMWuxni6sjJOJq/oUFzkZUk26Eh/c=; b=dwSFHh9wh3qZ1glgbh7/iHmezJw2AeaRdKaXWSBKIQamI+bBexaWvJH9pz+/HW8Mij zLr8ghsvyOL6ohMzCA5SXrka/Vg3/5ImVHhc+lUPdasZB7R5cjnV3AHczUT+7KoAXuPI OEGCG6747LFCMwHcmuk4l8T1/ylZzPCmdfgSo9JmEJy25RFz8to+O5ASJHGh37HxwlXV MHN6ul4D4vg1tQG5V04AC+CwaW8HP71ErLYCIZfZf7SIhM64wOjgXjRbj304EtMKmH62 IQe9OVp2vCdHwLIcMnDBPSbG3QI0cd6pLlvy3pE6c8rdQgFla0QNR9UotDlhkR8qZVn5 m1FA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9si16392332pgo.104.2022.02.14.01.28.23; Mon, 14 Feb 2022 01:28:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237836AbiBNIF7 (ORCPT + 99 others); Mon, 14 Feb 2022 03:05:59 -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 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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