Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp941044pxb; Wed, 6 Apr 2022 04:56:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+1enHuxLTekBuuvTxNm3XRi56dp3FzTL3H1xtN0w71t6CNa9LkedGpKNnVZuYKi7BQzlh X-Received: by 2002:a05:6a00:1702:b0:4fd:aae0:84a1 with SMTP id h2-20020a056a00170200b004fdaae084a1mr8611823pfc.12.1649246160687; Wed, 06 Apr 2022 04:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649246160; cv=none; d=google.com; s=arc-20160816; b=CfNa4A0RyQ5bZydvDqhVUxkC45wCkE6xbwC2q0f2M1x2X1wcObDKHHyljCqM+vNPCb F4dP40Fi70zoYBlw2fxaP0tP1Os87v6bqllr40PmPEX0Dh97c1qRvZjnPmLHaKtEQKbx iOJBw/CfeHOJbi5MQs4aATIlsDrqvA6alJT0Frn7UMoT2FF5P+DYD+Al4F10Hd2StwDM +2VvUmeUmKmscNVQSJ1GZz1vxM7YOB0ektAkab5v9lVFqyQohX5bwmmZpoEoqLx5aiQd YOKlIhd8A4fmiHkImIaB86LrPqNA2T4cncM75Poyg7xDinC3eIk8W72GhoKRnTYaeMkc qyOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=auXIsYszRBGPEcmXYjxTJIjCIDJa9XmG/H6OTh1gFbg=; b=NuygXWfYhzPgcX+HFmtYKGdKBxPX+daxF1q9kq71Wu/pHp7Icoiv/uYZyhvpN8dsz2 ZS9CYwQbecrUNpzfMrzLM09o2KhGoIna4xSN/ivTvdmPUZh+1xkD2b4cE77XcMzUGD+1 6xkxKNrLbNu3HlKtgIUUc2e/mGEQJpY+vSIWXXzs/+iDxJjbEEijFYVTGrKFZCpBAK2i bHhmbKGsDewN/4zPXZSEYjr0W54EPNKhN/P5oPezxf9Clkw1SWJ/9vURhXUK6AN4+ohk UdwntRD2PUf7UE4OLzbuKwBSUZ1UPrDc/ITkThSVFUBTct+12EiEoa9agHU9kHPx8/1x CGiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ja+btqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j11-20020aa78dcb000000b004fa3a8e0082si13876918pfr.313.2022.04.06.04.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1ja+btqe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2C79C64ECC5; Wed, 6 Apr 2022 03:18:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358869AbiDEUEH (ORCPT + 99 others); Tue, 5 Apr 2022 16:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354175AbiDEKMP (ORCPT ); Tue, 5 Apr 2022 06:12:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D67D50E33; Tue, 5 Apr 2022 02:57:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EC2E3B81B18; Tue, 5 Apr 2022 09:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E114C385A1; Tue, 5 Apr 2022 09:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152674; bh=fiVzT95+a5QkHnGpoPHbZ5qYYyO35JuD9pBA12LY8Tg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ja+btqe8+szqE05D2GTRsAPPAK5AxIlHm9WXmJQIOHcuO0XlqQDIZOUNXidReh1E UlGcJ6aa9NfniU8/SHFjVor/qXKeKKTqQMeeJNN9oHfjmzmuHySlVFCWmIHRo6xMUo BX1iy10PA4OXphR+G54UG0asd1/7x4hAlhotUVV0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alyssa Ross , Tzung-Bi Shih , Prashant Malani , Heikki Krogerus , Benson Leung Subject: [PATCH 5.15 861/913] platform/chrome: cros_ec_typec: Check for EC device Date: Tue, 5 Apr 2022 09:32:03 +0200 Message-Id: <20220405070405.634759278@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 From: Prashant Malani commit ffebd90532728086007038986900426544e3df4e upstream. The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands). To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found. Fixes: fdc6b21e2444 ("platform/chrome: Add Type C connector class driver") Reported-by: Alyssa Ross Reviewed-by: Tzung-Bi Shih Signed-off-by: Prashant Malani Acked-by: Heikki Krogerus Reviewed-by: Alyssa Ross Tested-by: Alyssa Ross Link: https://lore.kernel.org/r/20220126190219.3095419-1-pmalani@chromium.org Signed-off-by: Benson Leung Signed-off-by: Greg Kroah-Hartman --- drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/platform/chrome/cros_ec_typec.c +++ b/drivers/platform/chrome/cros_ec_typec.c @@ -1106,7 +1106,13 @@ static int cros_typec_probe(struct platf return -ENOMEM; typec->dev = dev; + typec->ec = dev_get_drvdata(pdev->dev.parent); + if (!typec->ec) { + dev_err(dev, "couldn't find parent EC device\n"); + return -ENODEV; + } + platform_set_drvdata(pdev, typec); ret = cros_typec_get_cmd_version(typec);