Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp446584iog; Mon, 13 Jun 2022 06:09:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi+NJbgadTFfyebXYom17Cs+XAAxwuK4GJRLrOuoqNbo/Zadq7ZuOtYTInLb2dTaRi2kwk X-Received: by 2002:a05:6a00:1744:b0:51b:d4d5:f34 with SMTP id j4-20020a056a00174400b0051bd4d50f34mr55697581pfc.0.1655125641477; Mon, 13 Jun 2022 06:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125641; cv=none; d=google.com; s=arc-20160816; b=mu0CG2ekxz+t2KJQZlDXFoNj3YWB9iOfTyuTOvcXVn7iJrcVa3NcM25xKS3ibFWTo9 vn+CEwRA7VNx9QJAS5FTWTbB6xLGwSbJfcVjRcVd4WtixLR+T9zR40TCpMwkz/Wp6m3y Cr/4cU12v5e2njf7DVX63GhJq20vz/EFgfJ7YPfHOSUI6Cxv1AGL2BsrZTVErHqXj27Z KwoGCOKOcF0ayK2flFIjyo7Hhcx9SfIZ7G4H5mWaRNo3s7V8RfkLHH5pTX0zhdbft1UU iYSGnDSiLCKW1UDz/zXSXIZGT0aHJ+Q+OHB/OrEkedCX5dkc3lWRSZHD0HVzK7famzCK Bl9g== 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=a2VLJC0gjTzxLUaqZrVWk6X8h+siED7ao/ilIfutvdHgrcgPaciJjvRPl+8TRsHdnc Bke6SEffakBOuM9BOSSzz37mRW9oRZOpq0u2iFif3GgEKpBQ7rFF8N09rholr/cX92n8 fVaW6AslPSavhPyO9RUyi6UupVqS9mVK8/FKGlaOxZkFMjxhUPQ3GIjCFXsH6AdbKNo0 no+BDPBIjGDOmu9ck0kWuI5w3rqevWZ3Nu8cxa0a7Lmvhxx9YJWMLmT/mPPhRbcYE53S iW46n4Csw/QUv0ywjk9Wgp1neoFzD894wMwT9tcvBrKi4sBVdln0NyyhwK45FKeBhX9A wbGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DSLouAit; 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 16-20020a631650000000b003fae900c345si8855996pgw.183.2022.06.13.06.07.07; Mon, 13 Jun 2022 06:07:21 -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=DSLouAit; 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 S243722AbiFMKpu (ORCPT + 99 others); Mon, 13 Jun 2022 06:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344383AbiFMKnK (ORCPT ); Mon, 13 Jun 2022 06:43:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 803CC201AF; Mon, 13 Jun 2022 03:24:18 -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 2CF70B80E93; Mon, 13 Jun 2022 10:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83086C34114; Mon, 13 Jun 2022 10:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655115855; bh=fUccMmsfOzKYZd6COXAYnrw2L2WSTwWeZlgrixzSPL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DSLouAitbcv04icFK/6k4lBWLz/vqDu6mKMaxwBKidvGBSVSqJ/TtprKKjQJojuyv dg/6SQHxK0LMXKOSuT3gNrdr5w0/skXZ5xGpEC5cL+8XEqTr0oblHtmmd+4Pe/waVG K8gKSxYp9fI5qBATX4F+1T3BSSGoaaM/dmbJFPTY= 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.14 057/218] spi: img-spfi: Fix pm_runtime_get_sync() error checking Date: Mon, 13 Jun 2022 12:08:35 +0200 Message-Id: <20220613094921.218969567@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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