Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4856418imm; Mon, 11 Jun 2018 21:15:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJjHQlyH4v7pYhGyyNr+c78IVNWsBrudKcQ1oAWS54yIitoGBc8ry6c24DeKQUto5zyu4Rs X-Received: by 2002:a62:6710:: with SMTP id b16-v6mr2074555pfc.37.1528776914040; Mon, 11 Jun 2018 21:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528776914; cv=none; d=google.com; s=arc-20160816; b=RoESaUQrcN+IW/5cTdnDRYDScen+Tml42gCmKYUZRnyt94K5yQuQvJGn7QUiR59Mgz 7wlBTOx1EdJmJ1TiQGUGjBCg2R5AxtAphRXGO7FcePv9QFrQT9y3CwMWMvg3c74WW5yQ iLPd0YgRysEE3oEclioPqhROqBWYtg1cOpmYMFKTHKuOWKnfs26Z5JCxt5D9GjyRAXk5 Wh/QuUls4gYMQp7vtl65X0pRL8YHxgKucgOOK7q4Rbgo1pXCDFYDfjUcDGUCRba6IFFv WdVSH1deP3907V5phVX2OX1tMHOV47oQuwfxSipdyT6kNaFm7ap/xEFplRRwUn/B4YMD sv1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=53jmd6VBTwCu1hs5bt0XrHUyKAV/JcKLjrCANFnXVRk=; b=tPx7Ehx5wZb/wAvRSvCkV1/Bp8AwSvIsDrSTfO4txEsn9M/dp3bOGPBhzJGtPMJ1/r YVabR1gcPDviVev0XMBBkYGfMcENBocp8YM07lLUn4WZCva8M7/wSD2npfgGYq5VaDHi 41MzG9rTzSEhSb9jCBIYHaEJDSBKpUKiti0rMaKdyRS3OT3J1+a+Wyt65uaplzplgD4k 1iMR+z0VosSrBcvTvEZaBqO8y6h0ytWeexjgB5OlxP0M/2/Xi5lhjtf12Dx6XkWKIf9z fhP9FUi02LxYbdd6EsX6wOt4zRA8gJgFp2Ypb/WIEpiNJbbX3bs38Nhmlm1arPzNRNK9 r7cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ks81H3Pd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3-v6si22885850pgt.106.2018.06.11.21.14.57; Mon, 11 Jun 2018 21:15:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ks81H3Pd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752659AbeFLEOS (ORCPT + 99 others); Tue, 12 Jun 2018 00:14:18 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35396 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbeFLEOQ (ORCPT ); Tue, 12 Jun 2018 00:14:16 -0400 Received: by mail-pg0-f67.google.com with SMTP id 15-v6so10813619pge.2; Mon, 11 Jun 2018 21:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=53jmd6VBTwCu1hs5bt0XrHUyKAV/JcKLjrCANFnXVRk=; b=ks81H3PdQ/Mrsz2jHqxTgFeBZhxCJ2RraeVFFoLinfbHhWKABLyvaywnoZs0GCb3AZ C50oyFI6h2anyxEHJWtdJ9p9j5pea4/ZXcHw80oXQHHjXN62xrLMiipLxH6kZqg+57pc TlcqQU1Wkmxwr3x5Kq/pZXaBlHn7Wby+tkgMbpCeMoNuz/NC5o+k5lfOHaw60GSuhqoL lxha5+PU1U+xDw43ARA5Eb8QRCunnwfBz7Gb+pM5ZXgIaUlofaVz1zhACy74gsDFHxJq SgA2IADrgCziVUIJ0u6pJRHZJGMMITkLuDcQNmffLSY6y9ggl+H1ZgRvM+7Xn75dSmIk 71fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=53jmd6VBTwCu1hs5bt0XrHUyKAV/JcKLjrCANFnXVRk=; b=YFPmwu1CRnFvb32LPcjtMKx6kSJ1LpZ1Pltk7jNpByF9viArli3YdHY5Evf5SQ3gBF cYWZqoeOWRjMoqxpTJzCax8vflYEcKQK6KO+/nX2pXU2zgVabELUdw4KBfCtLQIgBgBz mhru4Dgo6scfORqWi7cM6SqlAoUxmvIuyOvw1EMCh4dH0B5yvzqHdaw67kYHcOI/sIa3 YdG2dhW49cDZwbq6+2hhPkkWHZbZymCdtnHmDoCHKIPpfo24+U5MhtLrzX3+8m+jakrF qGULhnVZNkVJzqYz+KkwypMBb7tck6pRQjetXSY+bUyuO0lxWraCp1RZAUARsO/4DGVL ZRbQ== X-Gm-Message-State: APt69E3IqF5Ryb98cPw75lJJrdYU5k15AadpryVtnTB19uKuJbTmNPHt T7w5NguVdANb4pALSDKndLs= X-Received: by 2002:a62:9e0b:: with SMTP id s11-v6mr2080021pfd.198.1528776856378; Mon, 11 Jun 2018 21:14:16 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id a11-v6sm103309418pgn.64.2018.06.11.21.14.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 21:14:15 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Bradley Grove , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: esas2r: add error handling for pci_enable_device Date: Tue, 12 Jun 2018 12:14:09 +0800 Message-Id: <1528776850-39672-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When pci_enable_device fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling pci_enable_device. Signed-off-by: Zhouyang Jia --- drivers/scsi/esas2r/esas2r_init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c index 9dffcb2..364538c 100644 --- a/drivers/scsi/esas2r/esas2r_init.c +++ b/drivers/scsi/esas2r/esas2r_init.c @@ -707,6 +707,9 @@ int esas2r_resume(struct pci_dev *pdev) esas2r_log_dev(ESAS2R_LOG_INFO, &(pdev->dev), "pci_enable_device() called"); rez = pci_enable_device(pdev); + if (rez) + goto error_exit; + pci_set_master(pdev); if (!a) { -- 2.7.4