From patchwork Fri Aug 23 11:07:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11113701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 019A11398 for ; Mon, 26 Aug 2019 00:19:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DAFF820815 for ; Mon, 26 Aug 2019 00:19:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAFF820815 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xs4all.nl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C54EF6E141; Mon, 26 Aug 2019 00:18:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb3-smtp-cloud7.xs4all.net (lb3-smtp-cloud7.xs4all.net [194.109.24.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 488956EC77 for ; Fri, 23 Aug 2019 11:07:29 +0000 (UTC) Received: from [192.168.2.10] ([46.9.232.237]) by smtp-cloud7.xs4all.net with ESMTPA id 17PdikOP3Thuu17PhiogyH; Fri, 23 Aug 2019 13:07:27 +0200 To: Linux Media Mailing List From: Hans Verkuil Subject: [PATCH for v5.3] cec-adap: return from cec_s_conn_info() if adap is invalid Message-ID: <8dc2a979-ed12-6486-491d-35d216b3450b@xs4all.nl> Date: Fri, 23 Aug 2019 13:07:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Language: en-US X-CMAE-Envelope: MS4wfBxWB5x8jp3jOBbxkAlZJSsBvIQLS2KsAsZNqTiqDjORKeYH2HjKiQNMgOlXCr83c9DuSqXjqJxgxjLiBDJt1jPpsQ/sF69letl7RAAKtBdKiF8uw7Q1 WzUiLAQ3ROCFgooN5EHcevAGnedFv6drEx3gJrKZzPhi4EwsYOuCFYQNZuB8vddObUfZoCuSlSzGawDKuVpqi2bdEdeMp33XgzsGjt2jzOJgE7KrrZP4pe1Y wX6NV+JufobqoyrWWEHLkel/EvojE4Xk0uDJ9Fr3Wng= X-Mailman-Approved-At: Mon, 26 Aug 2019 00:18:57 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dariusz Marcinkiewicz , Maling list - DRI developers Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Check if cec_s_conn_info is called with a valid cec adapter, do nothing if it is invalid. This makes it possible to call this function even if CEC support is disabled in the kernel config. Signed-off-by: Hans Verkuil --- drivers/media/cec/cec-adap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c index 451c61bde4d4..5ef7daeb8cbd 100644 --- a/drivers/media/cec/cec-adap.c +++ b/drivers/media/cec/cec-adap.c @@ -1614,6 +1614,9 @@ EXPORT_SYMBOL_GPL(cec_s_phys_addr_from_edid); void cec_s_conn_info(struct cec_adapter *adap, const struct cec_connector_info *conn_info) { + if (IS_ERR_OR_NULL(adap)) + return; + if (!(adap->capabilities & CEC_CAP_CONNECTOR_INFO)) return;