Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4488840ivc; Tue, 3 Nov 2020 13:22:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwR+WqpVHzpUjP4/fDnOxJAyhbHE8k0Jtmwc/lrwCqfl5N7+2ZG8GhUYbl6vck4pWakqGNZ X-Received: by 2002:a17:906:a385:: with SMTP id k5mr20618057ejz.492.1604438575401; Tue, 03 Nov 2020 13:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438575; cv=none; d=google.com; s=arc-20160816; b=0PGeW1zYF0Hzk9svCKyu8ujSNDJW0xN4XDfardvTlD1ff+61BZWAB2DlqPUVrOL3+U kI3Hsmps4QDddcJu5psgWj5H/pPww4agrqD6J5Oz27Tc+Lr8WA7+qkHYSBVGoMmc88Kj SnO8cOCtYE2Nt3K4Z0eq+eke7FRu4JQQUKvagxLXseqktnmM49qK3XqMKaTLTS6IdXGK uqdvWheKAPMWdnPfu+bMowpXFDzEVuv9/yzLv5aRErJQhpnSc1CaZiWqsuuM6iiAeUXS Mreep4cRmvxLJDFXPhi0iHR8hd3WwFK05zMn4Z8TFrLfH8dvR6Rso0VJ1UK6X7XkBIDt xW7g== 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=g5XkOcHY7ZasZMnD42NqFZ2Zc6SgpMuVhIudYJ/iR94=; b=He9bcklJZnuEHHI7kW0PCHg4qDbOUYCHKurAark3IQ3b9osxh0+rgqktZBCBP5Yu0d MAR5UzS5LeXsxwF4ZLuH/aXbfAPhDpjZQnLmF1Gko7BYM3acKz9E/B13onWbfDsyiDE2 meIp43b4nXkca7uJhqO2sUUlnaJ5V7oX6B0XwvzzybPyymiPCgVKPfsPognYdmHxFiQh T9phrQw8LwlrXg8uD1IcrdEKo5JCUSplavzFKojHBLc1cVejjx76YOmHV4mQrEjR4p8o ld8bJuQkjpuwyp97a+cx2rPE5HD2K/I9dhmQrzRsOUYGjvrH5Ghbt7VH1OdtX+k762VH umDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g9hfEg4O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d19si13519812edp.276.2020.11.03.13.22.32; Tue, 03 Nov 2020 13:22:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=g9hfEg4O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388701AbgKCVKS (ORCPT + 99 others); Tue, 3 Nov 2020 16:10:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:50932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388388AbgKCVKN (ORCPT ); Tue, 3 Nov 2020 16:10:13 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5566207BC; Tue, 3 Nov 2020 21:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437813; bh=omCMwbtSSpyy2n/WDHZjzc96m/ab2hICi6j+nJa/RSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g9hfEg4OYdYIvyi8cwvx5YzehTZPZnxsus7H5YHFihWlHEZ4U9ZuLCVo1uIqsKWK7 fLXKAYlQ+NjLczIyk0Xw7K0nJA0UK6p6wpDEp3wiZB0BxDW4FhpGty/6hNrtw2nKWV 4t5Xeg8mrg5FnBqXK45nOPNj4Wx9ZMEdL+LITnok= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurentiu Tudor , Diana Craciun , Sasha Levin Subject: [PATCH 4.14 043/125] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io Date: Tue, 3 Nov 2020 21:37:00 +0100 Message-Id: <20201103203203.228936574@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203156.372184213@linuxfoundation.org> References: <20201103203156.372184213@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Diana Craciun [ Upstream commit 5026cf605143e764e1785bbf9158559d17f8d260 ] Before destroying the mc_io, check first that it was allocated. Reviewed-by: Laurentiu Tudor Acked-by: Laurentiu Tudor Signed-off-by: Diana Craciun Link: https://lore.kernel.org/r/20200929085441.17448-11-diana.craciun@oss.nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/fsl-mc/bus/mc-io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl-mc/bus/mc-io.c b/drivers/staging/fsl-mc/bus/mc-io.c index f65c23ce83f16..deec2d04c2dd9 100644 --- a/drivers/staging/fsl-mc/bus/mc-io.c +++ b/drivers/staging/fsl-mc/bus/mc-io.c @@ -166,7 +166,12 @@ error_destroy_mc_io: */ void fsl_destroy_mc_io(struct fsl_mc_io *mc_io) { - struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev; + struct fsl_mc_device *dpmcp_dev; + + if (!mc_io) + return; + + dpmcp_dev = mc_io->dpmcp_dev; if (dpmcp_dev) fsl_mc_io_unset_dpmcp(mc_io); -- 2.27.0