From patchwork Thu Nov 28 15:42:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13888190 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A41951B6CF3 for ; Thu, 28 Nov 2024 15:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732808543; cv=none; b=L59en22ms5DO2J+c+yKCxOV4uhRrn2smEXaST7CnDL9c1Vq+igyLcKHvogyF2w9I361f0eiGIqANjBTUCZK1XK0LuWTXMsZI9DwWVnxccfhQ1S90PUQ7hJjjwpHL76UJ/StFSeMNZU0Y3t3R782/lvKxHlhcvRPCXZR/6s56mck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732808543; c=relaxed/simple; bh=kxUjkLK5TukTfCZxyFHlZM9Z+ms3ahsOHr/fS55R+Q8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MNOF3XWGWcJhxZ0n4C6Bys0mrO+ixIQh72kTwOVX6Z6nFFVmPS5IfX7lQGkIof2rvatzA17rl18+kvpUm6m00DfKKvvASV2Agqzwp2J3Ugar2iB4CaaKK0WEb22GnHagcUKqhdCkRDG7MdRPDZDoKwKqas5hxD5O8JLRt2sgvdc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cEhSjoFw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cEhSjoFw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732808540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ya5MmXd9atYRw/V1bAU9JDQtj6xaWRPwiwaxSyuszuE=; b=cEhSjoFwWBw0jFRJOKkqh+jVtwf6K7WxJcn4nk4Q/xIPLuiqY17TIfoL51/zSVYEXOsXXy FfJN2fN/BYVNEZEBxfN+1nkxjtYB07olJkSlzNdQJCFDI1PCAqAgbNhMan7qI04aDdMtsF k9kG5/8wN48yIwbWvByWDMuxGaSsBbg= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-325-QSdCrnvSNgimUDcbVbZOgg-1; Thu, 28 Nov 2024 10:42:17 -0500 X-MC-Unique: QSdCrnvSNgimUDcbVbZOgg-1 X-Mimecast-MFC-AGG-ID: QSdCrnvSNgimUDcbVbZOgg Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4DCAA1955D8D; Thu, 28 Nov 2024 15:42:16 +0000 (UTC) Received: from x1.localdomain.com (unknown [10.39.193.119]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 72693195605A; Thu, 28 Nov 2024 15:42:14 +0000 (UTC) From: Hans de Goede To: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Andy Shevchenko Cc: Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH 1/4] platform/x86: int3472: Check for adev == NULL Date: Thu, 28 Nov 2024 16:42:09 +0100 Message-ID: <20241128154212.6216-1-hdegoede@redhat.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Not all devices have an ACPI companion fwnode, so adev might be NULL. This can e.g. (theoretically) happen when a user manually binds one of the int3472 drivers to another i2c/platform device through sysfs. Add a check for adev not being set and return -ENODEV in that case. Signed-off-by: Hans de Goede --- drivers/platform/x86/intel/int3472/discrete.c | 3 +++ drivers/platform/x86/intel/int3472/tps68470.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c index 3de463c3d13b..15678508ee50 100644 --- a/drivers/platform/x86/intel/int3472/discrete.c +++ b/drivers/platform/x86/intel/int3472/discrete.c @@ -336,6 +336,9 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev) struct int3472_cldb cldb; int ret; + if (!adev) + return -ENODEV; + ret = skl_int3472_fill_cldb(adev, &cldb); if (ret) { dev_err(&pdev->dev, "Couldn't fill CLDB structure\n"); diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c index 1e107fd49f82..81ac4c691963 100644 --- a/drivers/platform/x86/intel/int3472/tps68470.c +++ b/drivers/platform/x86/intel/int3472/tps68470.c @@ -152,6 +152,9 @@ static int skl_int3472_tps68470_probe(struct i2c_client *client) int ret; int i; + if (!adev) + return -ENODEV; + n_consumers = skl_int3472_fill_clk_pdata(&client->dev, &clk_pdata); if (n_consumers < 0) return n_consumers;