Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1105216imi; Fri, 1 Jul 2022 03:16:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v96P94q2dYKIdjKA05B7935gw7L+OvByYlMsM/5Kf0sZWEKtIG1XwDhioezdj/qUrF4vOy X-Received: by 2002:aa7:d353:0:b0:435:6a15:139f with SMTP id m19-20020aa7d353000000b004356a15139fmr17948239edr.19.1656670569169; Fri, 01 Jul 2022 03:16:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656670569; cv=none; d=google.com; s=arc-20160816; b=sCezkSLrJSB71KE3czDKcxXFmovwYACFBPs14MiZ9m8TsC6eC1vUULDjvYSKvEIUr3 I9ana77IH6JoxrwR9/uN2SuH3oF16ghWsmuNrfXBZPJeqe1YeaeQVtCxn5wYWYGFNKnJ J/GJn7TUrPTCouXeZd0dWgj1pkzTzVvSGUf+swN3l9ZCEZNaYaLxVnyIUOivAC+XM1gr hKMjhQ/SokcpTQxOUzbyqPYTO80ZfDfTDLgbRdcJqyulHMmX2VkTda6KVhmerP+A7v36 7NjeWacrcTtrCIGDZy4Y6E08dldnnnxZE0EEBIuUc8tzkcGp/tcKYBNKHSoQkoVokHRq EHRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=p6kCFP6khiA8SJP9C8dntl2VpFLesA+TfrROSxnjWKk=; b=qUEO165GW+mFBqQeQbhl9rU35JLQKEc+cfpsd3ktGsiMNjQixFoI8mCOHxCDHX0FyF 4+lUR44c6xuRWnFcdShEUlQfk22v0UC3EBMe7wG4aEPlFZVmH6YvcOVmO9tp5sR+lD0f hIeAhwuxRovApOjOnVB5nXOEAS1p1N2rm5cPHazcYguV3EAJ7m5bqjGzpCHIqDrS2FAt FlZwMXfTex63LUEUdQEr/JYryHn5PP4bEJ5UrKr0DZX4rJZHwRX6x3R/0D5U4CX0HKAv G0yqPY80arkxbGsFtvStZwNhLd+fRo5SUaR4YdFyFbyBnWLSRj9HF5tPhfzzEghRZcDl fd3w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg6-20020a1709072cc600b00726946aa164si20628709ejc.537.2022.07.01.03.15.44; Fri, 01 Jul 2022 03:16:09 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234866AbiGAKAV (ORCPT + 99 others); Fri, 1 Jul 2022 06:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234914AbiGAKAP (ORCPT ); Fri, 1 Jul 2022 06:00:15 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B4F7173918 for ; Fri, 1 Jul 2022 03:00:12 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BF6DC113E; Fri, 1 Jul 2022 03:00:12 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2F0743F66F; Fri, 1 Jul 2022 03:00:11 -0700 (PDT) Date: Fri, 1 Jul 2022 11:00:08 +0100 From: Sudeep Holla To: huhai Cc: cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, luriwen@kylinos.cn, liuyun01@kylinos.cn, Sudeep Holla Subject: Re: [PATCH] firmware: arm_scpi: Fix error handle when scpi probe failed Message-ID: <20220701100008.coh5mymwwxak5pnu@bogus> References: <20220701061606.151366-1-15815827059@163.com> <20220701094212.snsnbdjc7hia5oti@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220701094212.snsnbdjc7hia5oti@bogus> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,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 On Fri, Jul 01, 2022 at 10:42:12AM +0100, Sudeep Holla wrote: > diff --git i/drivers/firmware/arm_scpi.c w/drivers/firmware/arm_scpi.c > index ddf0b9ff9e15..6fa1a5b193b8 100644 > --- i/drivers/firmware/arm_scpi.c > +++ w/drivers/firmware/arm_scpi.c > @@ -799,7 +799,7 @@ static struct scpi_ops scpi_ops = { > > struct scpi_ops *get_scpi_ops(void) > { > - return scpi_info ? scpi_info->scpi_ops : NULL; > + return scpi_info && scpi_info->scpi_ops ? scpi_info->scpi_ops : NULL; Scratch that, scpi_info->scpi_ops will be NULL and it is fine to return NULL. Only reason why something can go wrong is if devm_of_platform_populate() fails and we return error after setting up scpi_info->scpi_ops. Can you check if the below fixes the issue ? We can continue working as a driver even if few of the devices were populated which could be the case but I am still doubtful about that. Regards, Sudeep -->8 diff --git i/drivers/firmware/arm_scpi.c w/drivers/firmware/arm_scpi.c index ddf0b9ff9e15..bae2e18e24ee 100644 --- i/drivers/firmware/arm_scpi.c +++ w/drivers/firmware/arm_scpi.c @@ -1024,7 +1024,9 @@ static int scpi_probe(struct platform_device *pdev) scpi_info->firmware_version)); scpi_info->scpi_ops = &scpi_ops; - return devm_of_platform_populate(dev); + devm_of_platform_populate(dev); + + return ret; }