Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1358567lqh; Mon, 6 May 2024 05:39:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5vllaJxD+0qZLC59hoc5W4jxDUvoUlF9l7qamHbTIW42oioqMFCIjbV9MjecAMPV9AnUFOqmz63AoyOFAkOJ3p9Qh6c5lNs2IspZSzQ== X-Google-Smtp-Source: AGHT+IFyHK8I4VxKACrM5QshkdSwuN9i0Ki4Tacc0oLAY6v5ErvTcJgdc1GDVKWN1KhHLYxa9+kb X-Received: by 2002:a05:620a:31a5:b0:790:e76a:33e2 with SMTP id bi37-20020a05620a31a500b00790e76a33e2mr15303928qkb.61.1714999178252; Mon, 06 May 2024 05:39:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714999178; cv=pass; d=google.com; s=arc-20160816; b=hFxXoKVUhI9NOnFf+spSSFAHIDEAmxfProAiRtB8ZNBy3I8va5Am+YOswd352mbXZ7 z/WiXdqsq4+E8mQyGYX0rIQ1ey1N+/jEiwnYL45I3tDrJ7xmJKctEhEss6DLb1oSO1RG wwos7dIQRKFmwfv2ADtjX9FGfkF1grDB2sS+jhsfRw2bqrops05wmFxJjUksuu0olXu0 Ctl4suoY7x938yduEbs6f0UacfWgvxB2EodaAXMSXvHvydjc+35HQGlCB5NwsXxnRPLt XcQZnXV4ZFm5sC2hnKpIAYQGZg6FIr5pJ/n5kfi34bZMVqEjPui/T4n7hoAb/fAVHvKh zIyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5Hkuj0HKDvuaVZat/vZwkf1H5ug1+hqs2t9w9FcU+/I=; fh=DraDGa44EbAfwWOJZNmyVMRrjQ9ZSb0RtFwmu6k44Vg=; b=ULDE+Ruv0/ns6YXKELGS2Nwq1QzCiYSAqz/9bWLluu7PfhgMCmcNA7nYOkwV7LKsDw SoyxT4bxI52pUOI1Sd2MhWrFXFTMu5ibBIMMbRK6HvQsoS4WbZsbuEfUI/fJOzrcCJRL M11cgNokBX6jYuPYXk9+C4yDNrqvtvWGL5+WBx2RSieqYnPqyXm4Lp4bSQ4afAS+3/wy zwHonk76Zj385AWildoGruQDLM/Y4EqhFj0rAgzpXblAiKyeQVMKrcXvTdzga0BnBVCk 3LEKOLQk6rEDeBkPZl5KIlyf4B+obIO7BI3BC/mxbWiaoI1RQHZukT20W2YA0I6BFu8Z zDWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGSN35JL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-169826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i14-20020a05620a404e00b0078eb9923f25si10012743qko.525.2024.05.06.05.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 05:39:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGSN35JL; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-169826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2CFC11C22E13 for ; Mon, 6 May 2024 12:39:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E854763E2; Mon, 6 May 2024 12:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gGSN35JL" Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47888335B5; Mon, 6 May 2024 12:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714999143; cv=none; b=T8DYVeixdjZx6tFdlL4GIrwuTa74spWa5Y+cZZQylzScgvltjMhMMSSI/tqWbdW8Y6Glju5qVZjdRmpK+EooVnvkF5pAhBcRgHKDINQg0GuAWZ+HGQDDVDTvdRULq/oElOcVwtZbvGlMbmoe7NAj27/y8XBfz4PqatITMNxsn1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714999143; c=relaxed/simple; bh=3Xlpqb/h/LbWUA++nfPRA220rLCTMZ3RCe9XHjr+l7c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hxLk2APawU0vJ67ictwAAbDVhgDBw5CjUMFrti7Y4yIFEniuQHCMXCJtgcMI1c39QDrkfhmRufTbyxINzdVG2cORTn424q8xEEE3ReiheAaZsq2wuvm78GDhpnS2LB05B/rqYfosyaxzfELqqhyCHvkkki0A87UEzjq6A9r5vk4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gGSN35JL; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6f44bcbaae7so1398483b3a.2; Mon, 06 May 2024 05:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714999141; x=1715603941; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Hkuj0HKDvuaVZat/vZwkf1H5ug1+hqs2t9w9FcU+/I=; b=gGSN35JLsPNH1XqkPHO8i3MeEdILygGEEuyn8wn7QiJhCfbZe2iPBxy4amaBQKM2FG UMLJrVmLraB5eH5xSSywDedEtcR/Tu9umhmvhPys1pikPFNTN3474gyyeKr+clIqmXmB Kvml3jvMkMQKsLx5wz2IstzNDujSYbMJcz5Sdnmsu1E8O9JXG+nMUFmrgbZmGnnKx/d2 fy4E/pwGIDp40FLxW+7ULFP66fYGMLplkkuyqbCUlrOW0fyFgviNgJpo4hDnHpHK70G9 E9M7fTmhu8Pb0Rn0S/XCfg+9+7gnWdzdynFAJ3jPtU5fyO1h515HDiRGPkzlWN2ZpmEz vi8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714999141; x=1715603941; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Hkuj0HKDvuaVZat/vZwkf1H5ug1+hqs2t9w9FcU+/I=; b=fbb6eoqf2I9YsjeEj8b6pnyKDA1L/d4A++wPSj/xIgqSAL/TMq+Z3Nu7VYWEw3PPtX drdqISv5xiWsudK1o8dIA+dhg9vL7w5JT/Dn1m5OG0BRQn51Dh24O0yO3Jta2UGaZ7db 5paxRWHT6bAkZlUxl0+aie84OZbgm1EO9n1zrc+R1kOdj3ypnh5SCrD8GzCFlFRioYQq ZhSJOzNd0wdX31lScsZj0cdQFYSKRzhNdCJJyKwgnm4DTiFJrROTDXEJA9o92OsR/TA/ cwqULPQeT87+Y/B6bx5SDMsH0QBW3uFqd7bFJa6UREBKzWE1hAaAbX9QheKfELKSwrJE Ab8Q== X-Forwarded-Encrypted: i=1; AJvYcCUoJui2aAObA+IszgDNHSYy3f80Qgk+GJWmq98MF4KCTPbEHfPC1/29HTxxuN4yN7FNwhf2lEt/5sbP3yFLl2QFnAbIpxs8gXFBEm7QZ4QYswjUua7rjlj+kjSTYE39jbo00lVqCkVswQ== X-Gm-Message-State: AOJu0YxxafMtjWpQNXz/uZdcbxzF0gTWfo6l3xkC+rL6zAhFbrOm33bl u2bDWIWRJF71kElf6QtuKN/JuzDNfoq2yQEhmVM3tVtUZOLddmYp X-Received: by 2002:a05:6a00:93a4:b0:6ec:fd67:a27e with SMTP id ka36-20020a056a0093a400b006ecfd67a27emr10838652pfb.1.1714999141374; Mon, 06 May 2024 05:39:01 -0700 (PDT) Received: from VM-147-239-centos.localdomain ([43.132.141.4]) by smtp.gmail.com with ESMTPSA id w6-20020a634746000000b005dc4829d0e1sm7940433pgk.85.2024.05.06.05.38.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 May 2024 05:39:00 -0700 (PDT) From: Yongzhi Liu To: skashyap@marvell.com, Markus.Elfring@web.de, njavali@marvell.com, martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com Cc: himanshu.madhani@oracle.com, GR-QLogic-Storage-Upstream@marvell.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, jitxie@tencent.com, huntazhang@tencent.com, Yongzhi Liu Subject: [PATCH V4 2/2] scsi: qla2xxx: Use common error handling code in qla24xx_els_dcmd_iocb() Date: Mon, 6 May 2024 20:38:35 +0800 Message-Id: <20240506123835.17527-3-hyperlyzcs@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20240506123835.17527-1-hyperlyzcs@gmail.com> References: <230af978-c834-423b-8d42-78c164be40b9@web.de> <20240506123835.17527-1-hyperlyzcs@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a jump target so that a bit of exception handling can be better reused at the end of this function implementation. Signed-off-by: Yongzhi Liu Suggested-by: Markus Elfring --- drivers/scsi/qla2xxx/qla_iocb.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index faec66bd1951..a3a3904cbb47 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2749,9 +2749,8 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, GFP_KERNEL); if (!elsio->u.els_logo.els_logo_pyld) { - /* ref: INIT */ - kref_put(&sp->cmd_kref, qla2x00_sp_release); - return QLA_FUNCTION_FAILED; + rval = QLA_FUNCTION_FAILED; + goto put_ref; } memset(&logo_pyld, 0, sizeof(struct els_logo_payload)); @@ -2773,9 +2772,8 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - /* ref: INIT */ - kref_put(&sp->cmd_kref, qla2x00_sp_release); - return QLA_FUNCTION_FAILED; + rval = QLA_FUNCTION_FAILED; + goto put_ref; } ql_dbg(ql_dbg_io, vha, 0x3074, @@ -2784,7 +2782,7 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode, fcport->d_id.b.area, fcport->d_id.b.al_pa); wait_for_completion(&elsio->u.els_logo.comp); - +put_ref: /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); return rval; -- 2.36.1