Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp179013pxf; Wed, 7 Apr 2021 23:58:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV5pWvMaJUjOrrGMXFQLE152JJLIheZn7SvHPSI5f1VNS9ld4I/eTWzwZvinl6wO6c9rJl X-Received: by 2002:a65:468d:: with SMTP id h13mr6551824pgr.373.1617865088986; Wed, 07 Apr 2021 23:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617865088; cv=none; d=google.com; s=arc-20160816; b=Wi8wPpvPjKox9uiO4IlwMo73YFPlq4d0o9fGi2okMf3Ws4FEKxkFCRqQ+AW1aeSCyC Nii5g8qMFx7PEn87eyZcK28OOO2nR86sWxRHAK7sHlyUKbI5JBomgMDm2ta504OxFRoD D42c7lcWeFSN8g0gocqjn9OrpchG8IeaOXho+8+0bzSXvLyq0Q8cP06D3vxj9Abf5M/D 7IY6jyIKakEMr61RLIE4Zn3TIk+opMCaMogYE0tC9yLexIymD5F281xEg5o3PTWQLpwa QtaHepcjx4fzqEEdVHP5qEH3GbtE9mGzwxx8+kYNyNu3FOpGis80gKSQl1/m76rWPvWn 66fg== 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=rSj8AjzC8a8YoYDrOeGROc9HVnsRxiuv5h2fS6yLwHM=; b=iUMqXL6gS2WrgeQ6YA9DrTmLzxs7VoXQn+V+80oWoMVgUmStalZBNV+JOyfPBvola8 1GrRVXOTj09PNUv7TT8K+M4FxDtjZnjEoflNJ2fo4Wr2O5sHtuoVW3YRdXPsb5wywgEe FTCWk09u+W0LWNZYe70G8FSPELtgfGvVPOIHEKGtx7XM8iOGvNM0H/kJ0QoXmxCSAoJV HGM7lValiNgFL7gWe34/sovpZORyzVQt/umB46DOD1fRxYAZrUUYAycpxF8JmvDlbHEl r8KkxLRu70/OrqTqYW1ZG4LLD2E/3X/cWD1eIBqq6m6b127J6tM1QWs5xfhY/EA7j+bw SDKw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si7922910pji.167.2021.04.07.23.57.56; Wed, 07 Apr 2021 23:58:08 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbhDHG5c (ORCPT + 99 others); Thu, 8 Apr 2021 02:57:32 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:21632 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229505AbhDHG5c (ORCPT ); Thu, 8 Apr 2021 02:57:32 -0400 Received: from localhost.localdomain (unknown [10.192.24.118]) by mail-app4 (Coremail) with SMTP id cS_KCgDXKQ5DqW5gpSabAA--.11409S4; Thu, 08 Apr 2021 14:57:10 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Mauro Carvalho Chehab , Sakari Ailus , Greg Kroah-Hartman , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] media: atomisp: Fix error handling in atomisp_open Date: Thu, 8 Apr 2021 14:56:59 +0800 Message-Id: <20210408065706.9681-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cS_KCgDXKQ5DqW5gpSabAA--.11409S4 X-Coremail-Antispam: 1UD129KBjvdXoW7XFy7uF4kuF4Utr17urWrAFb_yoW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.kernel.org Some error paths in atomisp_open will execute PM runtime decrement and unregister hmm pool even before we increase the PM refcount and registration. Fix this by adjusting jump labels on error. Signed-off-by: Dinghao Liu --- drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 453bb6913550..8f552d6f1f19 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -837,7 +837,7 @@ static int atomisp_open(struct file *file) ret = pm_runtime_get_sync(vdev->v4l2_dev->dev); if (ret < 0) { dev_err(isp->dev, "Failed to power on device\n"); - goto error; + goto pm_error; } if (dypool_enable) { @@ -878,9 +878,10 @@ static int atomisp_open(struct file *file) css_error: atomisp_css_uninit(isp); -error: hmm_pool_unregister(HMM_POOL_TYPE_DYNAMIC); +pm_error: pm_runtime_put(vdev->v4l2_dev->dev); +error: rt_mutex_unlock(&isp->mutex); return ret; } -- 2.17.1