From e793a637e249b54a911fa317388c93342845d34c Mon Sep 17 00:00:00 2001 From: Gauri Joshi Date: Tue, 19 Jan 2021 12:28:04 -0800 Subject: [PATCH] mhi-dev: Fix NULL error check Memory allocation for MHI client channels is failing. Resolve it by fixing the conditional check for NULL pointer. Change-Id: I98a7fe085482116236703e3af69010bade0130b7 Signed-off-by: Gauri Joshi --- drivers/platform/msm/mhi_dev/mhi_uci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c index 6c01e9b4c229..bde6945b0157 100644 --- a/drivers/platform/msm/mhi_dev/mhi_uci.c +++ b/drivers/platform/msm/mhi_dev/mhi_uci.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/* Copyright (c) 2015,2017-2020, The Linux Foundation. All rights reserved.*/ +/* Copyright (c) 2015,2017-2021, The Linux Foundation. All rights reserved.*/ #include #include @@ -943,8 +943,9 @@ static int mhi_uci_client_open(struct inode *mhi_inode, "Client opened struct device node 0x%x, ref count 0x%x\n", iminor(mhi_inode), atomic_read(&uci_handle->ref_count)); if (atomic_add_return(1, &uci_handle->ref_count) == 1) { - if (uci_handle != NULL) { + if (!uci_handle) { atomic_dec(&uci_handle->ref_count); + uci_log(UCI_DBG_DBG, "No memory, returning failure\n"); return -ENOMEM; } uci_handle->uci_ctxt = &uci_ctxt;