Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4602060pxv; Tue, 27 Jul 2021 11:18:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySOX3rJJqsGHJEe7NZoRr6vs04GseTEhwaxOtVp/AhGvBan4XKsfIzfC5UzFf5+xkXho58 X-Received: by 2002:a02:380b:: with SMTP id b11mr22580860jaa.83.1627409899187; Tue, 27 Jul 2021 11:18:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1627409899; cv=pass; d=google.com; s=arc-20160816; b=IDCvBsG5BBpg0g+F3+u3l/xnnCWkNpRsOd0qycYp86X3YQHqdlTpXw9gSXjZ+W/Jg5 +kj7jbntaIqhmlUVaXtdrCcTzgiHP0nbZm/AaVkRim/r2SEOl0n2rFxxATdsRvVQGkqK VHkFQ5DooIElHP7prKfULQV/Y9II4qFYKTr8d+Pa9SfZcK8uNVS9qf6VY+L6UnGO+VHH 4ZGlsQBg+HbjQqNkJrlkB912BjXQJOlGobDDuPpvRJi+ix6R5pf8I7WTYp5i+Q02QkAZ ZbrF3yTA7a3zO7SZQYjqQD9KlnfWtwZDR/onsjIe25qFpfvPKQc/Oz4w+qQCzGDZT/BY nVcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-language :content-transfer-encoding:in-reply-to:user-agent:date:message-id :from:references:cc:to:subject:dkim-signature; bh=hahvPfWSuFcLBXv+omPK6TMFftjbjBYgzXJdbYE8hQg=; b=IaVg7MGGhjKbEF14VMqx6ZyT3zlUsOFt/f7AIlx41kYz2reoTQPt9Q61Ae5ByvxAJ3 U1GqKWBA661dBjDtIv+0juQXtYl4DQbbWM82qvrCPFjIaQL2kmXp6tybE9llSCo7paob 6B4WlNPaMQdNbSkhRNtmmMEfey2FssJRU9HhqoYoJllEBlHpeYrxvS2K2q0EEaF6E1dG 1ke/hDu83dcc6rFtGDaY+L0WJZQvmCfCsPycgdoLOyQ7MQo6VmFUBbS8n4lHjo27shBc y0KCmWCp5N7zRCy2nN+vV4IR8RaMvMiMPoKKadSAMGeZnrEoa/VJ4KD3asWbtqQlX7/x RdjA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=CO7DSjIj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g13si4369024ilf.35.2021.07.27.11.18.06; Tue, 27 Jul 2021 11:18:19 -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=@amd.com header.s=selector1 header.b=CO7DSjIj; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbhG0SQ7 (ORCPT + 99 others); Tue, 27 Jul 2021 14:16:59 -0400 Received: from mail-co1nam11on2065.outbound.protection.outlook.com ([40.107.220.65]:4705 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229453AbhG0SQ6 (ORCPT ); Tue, 27 Jul 2021 14:16:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mjHjWwaA70rw0oLKSAajlLQq99kFphSBIOAKaMMFJUscUzwrHKcH8mqLtgsPG1PPVCbyDxLOQHKwVuRpCDuoLEaoWU47FWgU+3kmrrShzCYqaWCt6d+UAcEiqMQzNgJtUd+d4LXK6LPF2m7NHHR0Mg6+1Xsg3J6QZS9c5Ocm8q3DEPv+RirdJwihu0c6fFMwFJ77jB8aJC42f91fEgGY++LODQdSsgkm7KVUmIcnd/HsT3cdco2tlH5rqkgSlqTs43/+PuJ5ltsuYa8q9Y5e+al7Uus2a/JqRBABzoYgLVRGomkmlELBNmQlCDY9QpzPMywbU3dyP3R1Kg4UoPiMsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hahvPfWSuFcLBXv+omPK6TMFftjbjBYgzXJdbYE8hQg=; b=EqZVnYqAHrRMLK6z3oAKZfYy6PQmyI7Ps4IhPHviLAQTg8wLi0BfhGWe5WwOiBI3LR8v+wv7pbSR4OZiTmlOItEtY87a4EAbD4JfIY6kzIHFmoNOEZMhFJN5cWEpPe4hQswg5gWOMMvsTy/2a51ka54GNoViAc7j/ZtrvqamUg/NZzzZo5BCW4hqCxTiZPPd5arcE4AYIBM3SeOcRAOuRBFYtqQe8wTmwPCM+bzzkoKKvTRoHtnlSoWgnWP3YFVL8FfMZRXlGn8YyugBFyyJL3XxlQjPHufGLVuSwBzQentfEr3qnqqcUrSTquffZUvSxgze7dOFf68r6lBmiMS+yQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hahvPfWSuFcLBXv+omPK6TMFftjbjBYgzXJdbYE8hQg=; b=CO7DSjIjMg10YPONHpRx83BjedpsxwNJTSEtMN5Cpo0GiA0qmsND6mktDOysE7i9zXAaOIExp0Ja53SnhY6iPqDkhzWNhwroL+qv386yDouyPCEgH0VALaG5v82S59egsM5ow+D2EAZ/I9+VDmFZw/2uz+rCQ2e7sEUqciIFsRk= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from BN9PR12MB5129.namprd12.prod.outlook.com (2603:10b6:408:136::12) by BN9PR12MB5210.namprd12.prod.outlook.com (2603:10b6:408:11b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Tue, 27 Jul 2021 18:16:56 +0000 Received: from BN9PR12MB5129.namprd12.prod.outlook.com ([fe80::b891:a906:28f0:fdb]) by BN9PR12MB5129.namprd12.prod.outlook.com ([fe80::b891:a906:28f0:fdb%3]) with mapi id 15.20.4352.031; Tue, 27 Jul 2021 18:16:56 +0000 Subject: Re: [PATCH] drm/amdkfd: move PTR_ERR under IS_ERR() condition To: Cai Huoqing , alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@linux.ie, daniel@ffwll.ch Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20210720063435.373-1-caihuoqing@baidu.com> From: Felix Kuehling Message-ID: <7b968d16-9306-8fce-e93a-f88c964f46e3@amd.com> Date: Tue, 27 Jul 2021 14:16:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: <20210720063435.373-1-caihuoqing@baidu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-ClientProxiedBy: YT2PR01CA0001.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:38::6) To BN9PR12MB5129.namprd12.prod.outlook.com (2603:10b6:408:136::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.100] (142.182.144.73) by YT2PR01CA0001.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:38::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Tue, 27 Jul 2021 18:16:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a84574ac-053b-40e0-5b4e-08d9512ab7d2 X-MS-TrafficTypeDiagnostic: BN9PR12MB5210: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:561; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PIEbqsXjxIBNhywdH5iECbdSU28ZXLB5PDiketxI1r9u370bhjuyD4UiG130TOqGg7TOkWXnpz52m6ixg1pEYp0oMHVlAEsS6LHZSCiBr+FhSVMIQXHeMOPn/JQOkfiV1VTOF95TzQ7dN724ndfL+FlH20ZZFAZ2vyMuYHNWRFxompml/JufxWCaS9xGRvkrY0kuSTnopTVQi3O7BN9M/RNkxX4XksZTjngknI+PuJDl5nz+aXfECSs3ru5RY0RsNXFIT2AexpZTynYQOzM1LRiindPIM2cNZcFEuWn2qoZsyXYBYYq7ZzG/cwh3XzpluebtQ/R5/IrYcsg8VTNDXJhMWNsAjSzTTiA6SOPdljnMXoDE7GOXUgbcOkNeAEEvZLG6wKIUtjww0kYixyVjJbImzeb/BAfz2K9K+bJyCHRptStS78YlNWm4exKqLwIrS+E6ZL0DQQ9CbsNhsJyGHsrMu30z39CnLdHJFZWKlx6PUDCvHHq46AKqb8SbpCKw617X49wudMV6MedVakY54w8te7zK3JZ6AEG9/gszNDR2J9Px+mlmqP6I1oRCfHav0FOrK+3GjQ+RjXEAS6L7ko5gKRk7IkZ6V4kP1zE8E+pE/8k5u5+85Yl1S1mGRo/zlahqjJEW92anTZqF6vM0Nq7jpK2vSxvqvDe21flEnom4dzIr68Vq77DkXwhyLbkUKXWEN9VBJkNj87lHqrG4Wr2lnPS+KEBmHEej8F8xGCMnOjwXAOJGEVRadilhP/7y X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5129.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(136003)(39860400002)(396003)(376002)(2616005)(31686004)(31696002)(8936002)(186003)(478600001)(36756003)(4326008)(5660300002)(38100700002)(2906002)(16576012)(83380400001)(86362001)(44832011)(6486002)(66946007)(956004)(26005)(8676002)(66556008)(66476007)(316002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K1hzY2tSOFowN1cxaENtVDEvYzJqMkxEK3ZwcWF1WnZTeFV4V2Y4UmgwRjd2?= =?utf-8?B?VlBBaWVxVzB3YXNqczdwY2pMVktidGUzd1lpWUUwWUt6b3hRbnBkMnFOdm5U?= =?utf-8?B?eHZHTTRCRXZxUlRsYWMvbEh6REFMNmZiYThXN3psM2V1MFVDdE11TnljTWxz?= =?utf-8?B?Q2V2czlqVTBSelErNkVJQnRHdDlLVGN3d1dXenVZaXNSSms2d09ueC9xL3VM?= =?utf-8?B?TVVKdlpDSEZNclhJbG1KQll4VE16RVJhV1FEQnFKaXI2TzQwbDFZellYcFcx?= =?utf-8?B?VDBjV1VIRFlnYkZid24vV3lIZDhmRmlNaGgvUkJYdnhHNDNxY2pCK0FOMmFl?= =?utf-8?B?dXV0alpaWkhFL3ZnN0ZieEwxNEhEMjZNZHl0c0VzSkhkK084a3Z1Y3lzVG1Q?= =?utf-8?B?cm1xOU42TktKbFpVTUNQVFdmYjhMcGNJNDRKeU9kNEVZ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25FVnBFNWtqNnVKdkhJa1BnR1lHS0draGhM?= =?utf-8?B?TDFQOEhwN3Y5Wk9MWlQ3WXJsTS9KUmhIdVJ6bTM4NzhYdjdGa1pzU0MwY3cr?= =?utf-8?B?ZmpXaGFzdjYzRVRDYjV6S204emthWDNZYkhvMzNDQjUwUy9mdUZhOTdCa01C?= =?utf-8?B?cDdrckowd0ZuOTFDQ09vSWNRMzlNeDlaV1M0TGUycjM3SWZndng4RVd4ZXFx?= =?utf-8?B?YW9IOHVPR3ZxUWxvQ0MrYlFXNFpsZm55YXpINXA2cXJpMllOa1RMMkFQZm5j?= =?utf-8?B?Q2YvZHJEdnUzK3VkTlVCSlVlWWxpODY5UzVrdlZJSVpRT0JvNStmNFhlN2U1?= =?utf-8?B?SVNhYm10WG5oNDAvQ21kblQ0c2NsbWh6WXcrTHU1RHdYM0NJYXF0T3ZCaDhT?= =?utf-8?Q?5g66rwhySu8We/1qZp5i2/jjmYtY5s9Ob7WkRxt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a84574ac-053b-40e0-5b4e-08d9512ab7d2 X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5129.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2021 18:16:56.5592 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2QjSwswYOGAIob7Sari2ide9azxVmldzvRb57ePVmrhSMs39MVVjT8G7VqsOyoVJfeKBcqYSzCqAzeLSqvgFYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5210 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Huoqing, Your patch is technically correct. However, I don't think it fixes any actual bug, and it changes a code path that has no performance implications. Therefore I would just leave it as it is. Regards,   Felix Am 2021-07-20 um 2:34 a.m. schrieb Cai Huoqing: > no need to get error code when IS_ERR is false > > Signed-off-by: Cai Huoqing > --- > drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > index e48acdd03c1a..710659b3c1f0 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c > @@ -72,16 +72,18 @@ int kfd_chardev_init(void) > goto err_register_chrdev; > > kfd_class = class_create(THIS_MODULE, kfd_dev_name); > - err = PTR_ERR(kfd_class); > - if (IS_ERR(kfd_class)) > + if (IS_ERR(kfd_class)) { > + err = PTR_ERR(kfd_class); > goto err_class_create; > + } > > kfd_device = device_create(kfd_class, NULL, > MKDEV(kfd_char_dev_major, 0), > NULL, kfd_dev_name); > - err = PTR_ERR(kfd_device); > - if (IS_ERR(kfd_device)) > + if (IS_ERR(kfd_device)) { > + err = PTR_ERR(kfd_device); > goto err_device_create; > + } > > return 0; > > -- > 2.25.1 >