From patchwork Wed Feb 28 19:05:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 207969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3551485dyb; Wed, 28 Feb 2024 11:06:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGqQLR4sX9j5oSUp26CKTmPBbQqqIDOnnF3AwW9RJXIDhDQlQjsCk0dsA/F7RR6arYRK7fdvhXUbZh1HefssXKelvNJA== X-Google-Smtp-Source: AGHT+IFbFzLaQ3GFOXwZDfuFXMB8C7PIWbQGSuTejFbqHIKO690JQ6M5aG5cCqIzAiEdfju5Hja/ X-Received: by 2002:ac8:7f91:0:b0:42e:641f:8f84 with SMTP id z17-20020ac87f91000000b0042e641f8f84mr16563622qtj.15.1709147166853; Wed, 28 Feb 2024 11:06:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709147166; cv=pass; d=google.com; s=arc-20160816; b=Ex/OBpfl2paGhNn30jodPuUaf+R1eLvYV8UU0y1kGf5/mcocHoBBeYyBdreTd7uKbY 01knU6eQx8alARpeqwztGkHfUilnrOqToP3s9DBlM3t78NEb5ggj5NhBLXm1hcx6+Umg rWegbY1jptl0+YEn892TFWjjjaRn3DAS42i/1OzBDQGqT2UgatVvl3PvG3G/obdDuGv5 Jor0nEIQ+oqR9y9qn4Urz/vVYaVYuBuBkeLl7d+LgzDRNBx1/hloTwMDYv14BDxG+D3U BhdpkuUvHCFYOr7YowgU3brpH/rJuZdRTSLT3QbzFx7wU7EZswYp/7pT/3EQeOu5Re8O hsXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=VVIW5BWDLxsObFFWPOJ5xbNTd0o4JPD6uXro2iUXPvE=; fh=Vhg90EkZL6ZLchu4F2WIrbXOWXerzOeFyM2A+e1ONwg=; b=hwzGXyHM72hUcTm0MMT1j+FlK6cOg14gC2x8VLvBercPGAvITAedIjaccNSReEvIU7 rak0H5/yw/WfYp7f9y7wltfrxGWFtbPOe/pAYYrrtR/DsPsLmWr1JAAIFZcn3mpnIIGI b/m27nB+sFKWbqoguLDYaTjNa+QMO1iotsoMdITqF/DAjfidKCsNBuT8//1zxsJHKKQq p8uYszEMHjWCLwDurkELRT5+XAZm7ldxbB8090JcuFZH//M+ctEBHymxJ4yV7nTHmWYq rhzy7QOVHWUgl73H+qKJVrcATe5F+LOMIoK48Z67a/OAqohm7Hq6GtC1cdJN0gEWMFy/ aG5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Ck4oQstW; arc=pass (i=1 spf=pass spfdomain=flex--vamshigajjela.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-85574-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85574-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k2-20020ac86042000000b0042e3fafd6a5si86079qtm.88.2024.02.28.11.06.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 11:06:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85574-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Ck4oQstW; arc=pass (i=1 spf=pass spfdomain=flex--vamshigajjela.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-85574-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85574-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CDB061C2150F for ; Wed, 28 Feb 2024 19:06:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63A757443A; Wed, 28 Feb 2024 19:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Ck4oQstW" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78F987441B for ; Wed, 28 Feb 2024 19:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709147133; cv=none; b=hH59Q1ysqMhGvKOgkrpmnSWF0HyPpvGi6hfiA9BIC+9dRxrPsSw+m+wx0bF60Gdf1fkPizg99YBmgLILHH2YMmva7BuZ0N3oc0pQ9QWL2xSsJpZXkQjLRs5WYTQLEvb1QTChADorMHUMep2D94KL/d7CzLbj31jNF0lzM165CrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709147133; c=relaxed/simple; bh=KaB0o15QcxAJuDwbyWWEXp4xm4+9e6vAMCuWsrGK0EQ=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Xehq9fkuSusAQOpdIDKHMI2/DRGHl/h20hEycv4TyGLsYWn3dbI8SDUm5LLrzqYnhC8mpa3i7rDN9/3SS4ZroIwO2iuW3LeCkFMd8onLWVUB1aKFzOcjHAFZg0H2Fc3iN5sD99vAKvFYDK5jCdNLOdqTiKyV5fwK3xrIRHKnSs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--vamshigajjela.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Ck4oQstW; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--vamshigajjela.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6047fed0132so1653837b3.1 for ; Wed, 28 Feb 2024 11:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709147130; x=1709751930; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=VVIW5BWDLxsObFFWPOJ5xbNTd0o4JPD6uXro2iUXPvE=; b=Ck4oQstWBSKIGIxOi0albw5eHUoktwTJUkIsmut8HfL7duLmFUQt5ZCbYxnxafRjiY wpLxHrvoyH7ajS4B5cRSIKaKVPYcRUlfG5jVgrWtOvu9GiZzNTPPspJfJqSg8Xt/ApUr 1Bb2irPctZBxUqQ7VZQ5t3bVb0JapXXQBZoS1DFQpbOzOZvpHSsfGDQFUYyxxT6J2wej xsP66bu5qTQ1Gxzm/E19QqiQB772hWxXK3wfQNR7gDA3p2xLrayQoXMT52OEWzI8Lkyj KeugkcbpjMQTuRDVjHfzCTjAMBJ2odKVj2dMphOHKlI40rQZFA3My54fCyEAKnNg3a4J e+SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709147130; x=1709751930; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=VVIW5BWDLxsObFFWPOJ5xbNTd0o4JPD6uXro2iUXPvE=; b=cZNtf/ylKvF+h5CHZdYRba0+PIyAwgAiMCIOdVV0KdT1Evf7KQv11UDKmyxN2eLPJN RkYdLBQRPTuCzRUmLHmNebklFWkd47qCLSkBN+blEb/O8gjt6OMVq/ZR31VRDwA3KpaT VGjDKi4ZP10XgOoiJvi8pJuJPnxf6AY7/1/D76+uxCwwNw6792184gdlKFrS0++mOhxY zxHXLs+A0eBW/6Hq/uRxYk547Xc1g0AksMaVvVM84XgmsbAKYy8jWxKB/OlJlWs/C792 4k0BstSEDqQDNXe4jZLSoJHI1/pxg6Z7REP5otS4YE5oVFDmU9NRUSmMJFs0psUEaEzj ZNow== X-Forwarded-Encrypted: i=1; AJvYcCXo90tfmorG3jXsEW6Emc5jyzbpN8ewJAedzXsEclUHnQ9XUFG1bg9jJx38J0kkbCAiNQOFytNXHHPaMgi5xY7TfSjDdOhX573+zPad X-Gm-Message-State: AOJu0YzU3FgAGbpnkdGq/r/2pBANzHBL9ZyA2yWMpBxvqur6zO/JSf6x ZPWi93eK/vDZoS6iibljWYNJS4z2nPNLvaAS7X+Ppnwkivmr6gkA6VOeGUghY2Aeqd9okP+0t2D AJbt2nB1sZ3krAWTApGWseaFcbXz+fA== X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a05:690c:9d:b0:609:254f:85ae with SMTP id be29-20020a05690c009d00b00609254f85aemr1080823ywb.1.1709147130454; Wed, 28 Feb 2024 11:05:30 -0800 (PST) Date: Thu, 29 Feb 2024 00:35:23 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog Message-ID: <20240228190523.8377-1-vamshigajjela@google.com> Subject: [PATCH v2] spmi: hisi-spmi-controller: Fix kernel panic on rmmod From: Vamshi Gajjela To: Mauro Carvalho Chehab , Stephen Boyd , Johan Hovold Cc: Caleb Connolly , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Vamshi Gajjela X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792170699692667883 X-GMAIL-MSGID: 1792170699692667883 Ensure consistency in spmi_controller pointers between spmi_controller_remove/put and driver spmi_del_controller functions. The former requires a pointer to struct spmi_controller, while the latter passes a pointer of struct spmi_controller_dev, leading to a "Null pointer exception". Signed-off-by: Vamshi Gajjela Fixes: 70f59c90c819 ("staging: spmi: add Hikey 970 SPMI controller driver") Cc: stable@vger.kernel.org --- v2: - Split into two separate patches - add Fixes and Cc stable drivers/spmi/hisi-spmi-controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spmi/hisi-spmi-controller.c b/drivers/spmi/hisi-spmi-controller.c index 9cbd473487cb..4b6189d8cc4d 100644 --- a/drivers/spmi/hisi-spmi-controller.c +++ b/drivers/spmi/hisi-spmi-controller.c @@ -326,7 +326,8 @@ static int spmi_controller_probe(struct platform_device *pdev) static void spmi_del_controller(struct platform_device *pdev) { - struct spmi_controller *ctrl = platform_get_drvdata(pdev); + struct spmi_controller_dev *spmi_controller = platform_get_drvdata(pdev); + struct spmi_controller *ctrl = spmi_controller->controller; spmi_controller_remove(ctrl); spmi_controller_put(ctrl);