Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp572595iog; Mon, 13 Jun 2022 08:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsdIUyLvJQN11Qjvv50RfjMfoTyQDfVQVgw0dcgcGczAgLiiSJPaAbLyCzyNl0kgAAmZs4 X-Received: by 2002:a63:1b26:0:b0:3fd:8db8:9602 with SMTP id b38-20020a631b26000000b003fd8db89602mr114528pgb.239.1655133751988; Mon, 13 Jun 2022 08:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655133751; cv=none; d=google.com; s=arc-20160816; b=CTOusWVI8bcSvw6vILaxp85jhKCSIiwiP5ojaxUoUmlTPVd71I1/wtqmuNQPZQrWg4 tKXBEbmRgc4etWhWwXWFFUHrqGGLoOvo6jJsNcpuOWcDQpmGXCNiwoURCY5U49p0QBoK ep4YcDZ3aeEy5SWvYMViGr63pLdBKQvVqxdMoeFCy54NXpMZzkwz8EC2a7tUhIGww68o nnDjl8bnPNgBbASxupO/7li/2+Drn/a31MnPw8BrA86Mx8PSMc8bbl4dMosuTPyWZdRT /LzkKXf+vHize4KsK3LJ1XugS5OKUyJDaRebB/oS7z2NC/ifMjAgv2bhuB9JHrcZxisr Ly3A== 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=QpbNB3ICfiOuVaIy3ghA6LDtajbGtM76591PBU3a/Ao=; b=Gns+X1IaNNjgXUHFgKrz5mf5eN92wnkaShX0uKiJfrMNWYDKiXtt+2LEg4dbTqfLe8 CtyfSA81YDJRhqHdJoJzwUXVvj0yzTCgrMNUzD7d8Q5ReXULy5ftGlbDWHgNjvDB9Q+8 7oSywQmtvMnNbKtv2hlHAkHsmAj2xtC8my/FamfUZLVrhtxFAYBmvFWnvBIW5GmgowR1 mJtNFR5WbHsUOIDRHzlGxlkEnic92Vzxc6T0zZeVHTsjHN7pWqoeeYnhmdtdR0WyixqP l7XJu0KgzGmtiT3pVw9+RcZBS8+lNg6vzQ868xLOxrvBzgf70UnFqu+WICIerFEtJXXr aDLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="hP/aRMI8"; 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 p24-20020a1709028a9800b0016356bd88e5si10070213plo.419.2022.06.13.08.22.18; Mon, 13 Jun 2022 08:22:31 -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="hP/aRMI8"; 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 S242123AbiFMKTL (ORCPT + 99 others); Mon, 13 Jun 2022 06:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242147AbiFMKRy (ORCPT ); Mon, 13 Jun 2022 06:17:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD69AB1D8; Mon, 13 Jun 2022 03:15:51 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 63ACE6149D; Mon, 13 Jun 2022 10:15:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74620C34114; Mon, 13 Jun 2022 10:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115346; bh=fUccMmsfOzKYZd6COXAYnrw2L2WSTwWeZlgrixzSPL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hP/aRMI8uYsQlM84ZY494oprEYCia2SP03OUUbuwUlUc2c8AWVXCLfAdaAeLu2CaY L0/9ggOuDVe/lO+dHcoqS9vLmdaNwwhlIDrGhWFuzOtYsbOdCHRkaHp2B3x78O7xRq 5DfT+oeLvNn4Xu2VfRtxEeTSS4sWV2+CpT/FK8Gs= 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.9 043/167] spi: img-spfi: Fix pm_runtime_get_sync() error checking Date: Mon, 13 Jun 2022 12:08:37 +0200 Message-Id: <20220613094850.996851017@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094840.720778945@linuxfoundation.org> References: <20220613094840.720778945@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 2a340234c85c..82ab1bc2196a 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -771,7 +771,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