Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp579397iog; Mon, 13 Jun 2022 08:30:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7ahjZf/BK5cZ+hM3giemQYJmjdUUJv19psUF/IMW/VG0fOrm2nPywLvhU52REkakjnzqA X-Received: by 2002:aa7:cf90:0:b0:42d:e38b:9936 with SMTP id z16-20020aa7cf90000000b0042de38b9936mr279147edx.327.1655134232639; Mon, 13 Jun 2022 08:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655134232; cv=none; d=google.com; s=arc-20160816; b=x0Eb/UWy3+GfVHOrz21lfkOO6GW8TGbPkra6QMCEKmp+Zb9M39vfuBA0thwQEox5dV qfP0YvrrI1crQJhyaTbhdNNCZ44gAIPJbR1bdFQbOfnxDRooDLvGJqIc3Ht6PeWeGBsC xOKDGIk4zJs9zg5DVTzvuGDTtlCadmML3hKJ4BVo0rx/ZPLI7q0IMNYA2bR9N+P2b3nR Zv/JkJCxkGzLjZ/7pT3oX4EqXJ5PHYr8+LW9PPCYURbMyyDOC8eUDpxv60dFB2NffVtT h1T1sCMuGo+RHJ9hK+G7RjsgTWEK7r4xGvcrDV2blye5FiKe5GOuAg6NPYvLmu1gQLwa OYrw== 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=4wDxcxe1unat4n/WkIEMvE/pqyrg6k3KMo4kgc9bpv0=; b=x1Ti4nsVcfuQA6QDGc3N3T/U+27N8/4OhCA0lzbfOSJAXWQXSDlrgF7pgLxjHPpN01 Sa5UTN2Z9ElpaKCI3x5jISu4pQmM/DrQGlJhV58vEp/azIYpuvtjZE5NOM5Fc/LtaPOi Zgypbq4eWEBdGiCkhQ5fhKiK6BJ3dwap1P6vsXAVJ+LrYPsHa6mt36MW+yS9hCpHfbwT 8qgCbnzEh5gJL3SJwCjCvQsjHBrWu8Xe+K+jay9WkUfofDA2WMj3/Y8rnuWC4/mV97nb tqW08/GL/CDa5XEErq6rEcGFp2Casl6RAs9DDGrPJGtM0i9YliuNiWAp6JdvWahLDvOe M9ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRN0V5bm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb40-20020a170907162800b00718cd33f793si1914523ejc.158.2022.06.13.08.30.06; Mon, 13 Jun 2022 08:30:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cRN0V5bm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357871AbiFML63 (ORCPT + 99 others); Mon, 13 Jun 2022 07:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356601AbiFMLup (ORCPT ); Mon, 13 Jun 2022 07:50:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4A72EA18; Mon, 13 Jun 2022 03:54:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0206AB80D3F; Mon, 13 Jun 2022 10:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ACD3C34114; Mon, 13 Jun 2022 10:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117664; bh=fhjPAmRWyY02XT6ng4KNawILXabYHwz5rSxvO18rIYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cRN0V5bm7RyggXqWSn62pZkCSs2gHntk1YKSJfYyA+Y68hc5looLJawaZ6KydHaPQ a937ME6FLVfUxS6t7AzENWjuPOWhZ/1mLStfcAS28btSgJrXXSA/9wjJqjAn62nlaN qaDmTQRLhdVgLOquVtEZYCnQKUnxa9CqlGSQrMkA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Mark Brown , Sasha Levin Subject: [PATCH 4.19 073/287] spi: img-spfi: Fix pm_runtime_get_sync() error checking Date: Mon, 13 Jun 2022 12:08:17 +0200 Message-Id: <20220613094926.086471985@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094923.832156175@linuxfoundation.org> References: <20220613094923.832156175@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zheng Yongjun [ Upstream commit cc470d55343056d6b2a5c32e10e0aad06f324078 ] If the device is already in a runtime PM enabled state pm_runtime_get_sync() will return 1, so a test for negative value should be used to check for errors. Fixes: deba25800a12b ("spi: Add driver for IMG SPFI controller") Signed-off-by: Zheng Yongjun Link: https://lore.kernel.org/r/20220422062641.10486-1-zhengyongjun3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-img-spfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 25a545c985d4..c63cceec6312 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -774,7 +774,7 @@ static int img_spfi_resume(struct device *dev) int ret; ret = pm_runtime_get_sync(dev); - if (ret) { + if (ret < 0) { pm_runtime_put_noidle(dev); return ret; } -- 2.35.1