Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp253785pxf; Wed, 24 Mar 2021 04:28:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3vI/F/HDFgEnEAxaiwaQINcvvZ9zhPo77v4rQ8EjWJhTcyyED2CDSjkiM+oPkgWiZKI26 X-Received: by 2002:a17:907:9611:: with SMTP id gb17mr3187104ejc.325.1616585333066; Wed, 24 Mar 2021 04:28:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616585333; cv=none; d=google.com; s=arc-20160816; b=YUEKCqnGAD7DtlSHKu2gbGYEmM4y/deuOJ3IMNOcE3wfYdjvgOrmBNn/wTFTQvGyfA nMoQTEZHrNW+4gxPhd8ZlLWRoi8mQp9SNnCB3bwGFUKsZAl1hmrNg8Hg7m6tYPzGLv9s fEKMTKE15w8a39ECBALrtGlXqcouA4ySI6uxx1+LLdx7ni/ggYz1qPeaA9jM4pXOF1xm 8BIaTDCbStw1FvGXccZ+qGn+/mHR018vEiR5PSNPNZ3IcqlzsmuKCCBArUDkwiofUWco F0YDGN1rgpXdFqAgzqbro4BOaH6rrLCBPJd/GWskUOdjkV56lFf5venePYaxMAiUhny5 teqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=khXQAiAsCwEL1VNyFBqgnHjjuLgSQIepNA+VzkS4ME0=; b=isEVQaUpWcibz2d5lH2UfXBkSWQfggDBNiYUi4PC7wZiPwEchQvyQFEwMwnsNaZn6B a5oVpVIZiy34IMEAkH3KqG1aP7AyArnLgfPmacQ39FE7qC6TScR7wbeXUMa/N0+jLrwS fVgSZQ4WkuRcssbFxFmultaQhyjrN0SgjUIn0UDimq2GrzSGWicFfH0stCmIQHo8MzCY fIhP232j5FYufLkXSa3ykxZ2dgIKiGT+7DInTYOZxEFX9nXvC1MqdzRkQuEjnTHUxAHL rAWldxTgK52AJ4fgi8wFnFhHUnt8JHYYYUrynrkOAXBmtn9C4n/57m4YA9HryVcu0PlE kMGA== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si1531222eds.158.2021.03.24.04.28.30; Wed, 24 Mar 2021 04:28:53 -0700 (PDT) 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; 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235210AbhCXKGs (ORCPT + 99 others); Wed, 24 Mar 2021 06:06:48 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:52526 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233165AbhCXKGF (ORCPT ); Wed, 24 Mar 2021 06:06:05 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R491e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UTAJrkW_1616580363; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0UTAJrkW_1616580363) by smtp.aliyun-inc.com(127.0.0.1); Wed, 24 Mar 2021 18:06:03 +0800 From: Yang Li To: arnd@arndb.de Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH] misc: rtsx: check the value returned from a function for errors before being used Date: Wed, 24 Mar 2021 18:05:58 +0800 Message-Id: <1616580358-93156-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add missing return value check in pm_runtime_get disabling the sensor. The issue is reported by coverity with the following error: Medium:Unchecked return value(CHECKED_RETURN) CWE252: Value returned from a function is not checked for errors before being used. Calling "pm_runtime_get" without checking return value. Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/misc/cardreader/rtsx_pcr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c index 2733111..2cc37fd 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -142,13 +142,16 @@ static void rtsx_pm_full_on(struct rtsx_pcr *pcr) void rtsx_pci_start_run(struct rtsx_pcr *pcr) { + int status; /* If pci device removed, don't queue idle work any more */ if (pcr->remove_pci) return; if (pcr->rtd3_en) if (pcr->is_runtime_suspended) { - pm_runtime_get(&(pcr->pci->dev)); + status = pm_runtime_get(&(pcr->pci->dev)); + if (status < 0 && status != -EINPROGRESS) + pm_runtime_put_noidle(&(pcr->pci->dev)); pcr->is_runtime_suspended = false; } -- 1.8.3.1