From patchwork Wed Sep 9 09:43:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11765179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C811559D for ; Wed, 9 Sep 2020 09:44:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D86C21973 for ; Wed, 9 Sep 2020 09:44:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="PjbmMnZ5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730324AbgIIJoP (ORCPT ); Wed, 9 Sep 2020 05:44:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:32886 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730316AbgIIJoJ (ORCPT ); Wed, 9 Sep 2020 05:44:09 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0899XZYE100632; Wed, 9 Sep 2020 09:44:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2020-01-29; bh=4+A9QYHKTlm2FFL9KE51eg55g+ypDXFe4GvLy9eLIr0=; b=PjbmMnZ5gaKkgGUAAOikBDTpPFiBKajuTiYzXg/eVA6z025l18T3irxc46HOJxTZx4lz C0HrxE6Pu1PeIMcmrLRLtvEsrq4oxH8KXQkkDUw/tU/gxvIbMLaO7IdMW6dvaZCmjqcQ iBil/UhrytrGzFR8W+pNDNM1kaZHV9hPhHgidbiv3Lglo6+m5w0N0B/WxObMq+a2ouEw z8yhTKu0CMXEe8YqLBFm3GczghZhPX0CbkTKrm/7bg8QKgzF1WL5saOlMgLJzOmaDqSB fxsLzMgyyx48SMIO4YBWYkJ5ovEjs42vxiuwLc9Nhzsy3d+NDxt71I94yccXMJ1lHDjF Zw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 33c23r0rdf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 09 Sep 2020 09:44:00 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0899f3jp029792; Wed, 9 Sep 2020 09:43:59 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 33cmk61918-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Sep 2020 09:43:59 +0000 Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0899huOq025554; Wed, 9 Sep 2020 09:43:56 GMT Received: from mwanda (/41.57.98.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 09 Sep 2020 02:43:56 -0700 Date: Wed, 9 Sep 2020 12:43:04 +0300 From: Dan Carpenter To: Mark Brown , Amelie Delaunay Cc: Maxime Coquelin , Alexandre Torgue , Alain Volmat , linux-spi@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, kernel-janitors@vger.kernel.org Subject: [PATCH] spi: stm32: fix pm_runtime_get_sync() error checking Message-ID: <20200909094304.GA420136@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9738 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 bulkscore=0 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009090086 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9738 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009090085 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The pm_runtime_get_sync() can return either 0 or 1 on success but this code treats 1 as a failure. Fixes: db96bf976a4f ("spi: stm32: fixes suspend/resume management") Signed-off-by: Dan Carpenter Reviewed-by: Alain Volmat --- drivers/spi/spi-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index d4b33b358a31..19064df42d25 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c @@ -2060,7 +2060,7 @@ static int stm32_spi_resume(struct device *dev) } ret = pm_runtime_get_sync(dev); - if (ret) { + if (ret < 0) { dev_err(dev, "Unable to power device:%d\n", ret); return ret; }