From patchwork Tue Nov 7 09:51:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13448234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A5D7BC4167D for ; Tue, 7 Nov 2023 09:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BRDIXpLmMnXMwHwBc+RyyUz1kZgIYFYWhI16fP75OGs=; b=CK2zPlb4ODPG+i bjmrlLPqmHjztzgfi2vtXqUNF5FPlNeONRyuU6KX5KnGmEz1WaOmGujX4HCzaXDxqWN8scDkOngZo RhJUjvQx9DHh5CghPOvEU7rfsHkSGqhercLXoFg92nF4nsF/n4iRkzW6peMJeWIAkHkFx+2qU4Wye zxTsDeyfWWqvSNpMCKuaZENo9RlCm1Be8WAaq5O0LsutbxeIlEM3RfJV++jqNu3J5mZy8MSFVnzZ2 lZz+qp9ym+JyMoXYX05L3aEL4d5IphZAo8JI9i02ULYxqOK7VlWhAmL1cTkgpMHpqyn4Hw+lmhZtU VeXippeO6GecMEzqZwSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Ikq-000xL4-1Q; Tue, 07 Nov 2023 09:52:16 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Ikn-000xJT-1J; Tue, 07 Nov 2023 09:52:14 +0000 Received: from umang.jain (unknown [103.251.226.110]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6CD559CC; Tue, 7 Nov 2023 10:51:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699350709; bh=XcQcBwrrItguHb39ejr0MBXHrExUnC6HOo/l8SOH7Lo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hEbFaEIha4d3W0T1gYuX+yETR3FW0eTsMe98KolaO8pHDCmAoSkljtw9uvLW3XWR1 Me5AyVgYOBqnM2I/Ej70mMLsDzCGoj+9PDG+Dq5WE7niD3eaewn03hnQzM0nkw+ruK vZSJcSc31fXlevATWXCFTfyU8G3hnyCgOFfqhUf4= From: Umang Jain To: linux-staging@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Cc: Stefan Wahren , Greg Kroah-Hartman , Dan Carpenter , Kieran Bingham , Laurent Pinchart , Phil Elwell , Dave Stevenson , Umang Jain , "Ricardo B . Marliere" Subject: [PATCH 1/9] staging: vc04_services: vchiq_core: Log through struct vchiq_instance Date: Tue, 7 Nov 2023 04:51:48 -0500 Message-ID: <20231107095156.365492-2-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231107095156.365492-1-umang.jain@ideasonboard.com> References: <20231107095156.365492-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_015213_604595_62437516 X-CRM114-Status: UNSURE ( 8.19 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The handle_to_service() helper can return NULL, so `service` pointer can indeed be set to NULL. So, do not log through service pointer (which will cause NULL-deference), instead, use the vchiq_instance function argument to get access to the struct device. Fixes: f67af5940d6d("staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug") Signed-off-by: Umang Jain Reviewed-by: Ricardo B. Marliere --- .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 39b857da2d42..8a9eb0101c2e 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -245,7 +245,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -287,7 +287,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle) return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return NULL; } @@ -310,7 +310,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h return service; } rcu_read_unlock(); - vchiq_log_debug(service->state->dev, VCHIQ_CORE, + vchiq_log_debug(instance->state->dev, VCHIQ_CORE, "Invalid service handle 0x%x", handle); return service; }