Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4871558imm; Mon, 11 Jun 2018 21:37:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYmnzv21eAoEqauYzdQGMF44YvUTYRm4q/gkfho8qaoqdU3SIDbD259ZSlnhyAUdjcYTYc X-Received: by 2002:a65:6157:: with SMTP id o23-v6mr1819947pgv.310.1528778239834; Mon, 11 Jun 2018 21:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528778239; cv=none; d=google.com; s=arc-20160816; b=Ffmt0zAm0Vw/JZyNqkblUgRQ2aBXuCYuk+kPY8cdyQv4Uh1vb+lu6lN4lNg0EiVfPS O1Dkkw1RRhF7lgM2JLTGVm/9GTq6obZc2ho8YNlhxqDTMDYaBnfBPKm2oZ/QngQZGEHw XHtRU7ASkoDyGgp2TyqEl8wKgwR7pyywfLWPYBmeXoMvFlKtt47FSVWC35C581sYKhUn Mqjg/zHNYPg7HYZE9++t+ua4zXm2GoWyTFPKQzagjrYL0+/ygm+BGroj5b9TlKKxxJ5z 67pKvcfaLZ8eMjRcepxQzKeZZKNt9wDB3+htbHcyxOkoc1Q5kwCSQSgj3PiTdjYqsq4y N3vA== 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=u2y/COd7y8AES/tK0ar8bdl7+Wngd4RVNZyzRK4JZmE=; b=rZuuYImii2CXSOXLidy5hcA6qOn12pXmJX1ZfnrvDY4L8uwdhdBK1Kvab5QwFsuIVf yc22pqNjDRtaxlnpt+DXsz/D14eOUTmzM7vqIVWJrKLKu/cmH7NPVzrD25nk1qwa48Fy uOmV32wn5eoPtTfmBhLSE4paggdQ7MNxEc1BlZXNMpQwMbSdAH7rJShjZa+IE/8X68xI j6w3Jvs87TvGclqGqfHD8cwilQlWKsnHOA2jjx+okt2lmadv75WGEh6nS6CjuZ8C8sT5 hAk+ZagK2nbUzSgWhEbjRRYQT2O0oGtUw1PDboZjxq/E848KEbiDoy0ASoZqFnsZ5kjx y7rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=bWyVx8gV; 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 q10-v6si2733792pgd.108.2018.06.11.21.37.05; Mon, 11 Jun 2018 21:37:19 -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=bWyVx8gV; 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 S1754095AbeFLEgg (ORCPT + 99 others); Tue, 12 Jun 2018 00:36:36 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45551 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752839AbeFLEge (ORCPT ); Tue, 12 Jun 2018 00:36:34 -0400 Received: by mail-pg0-f65.google.com with SMTP id z1-v6so10829199pgv.12; Mon, 11 Jun 2018 21:36:34 -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=u2y/COd7y8AES/tK0ar8bdl7+Wngd4RVNZyzRK4JZmE=; b=bWyVx8gVe8Py4PiMNhLiHpvvBH5DCY1++MQ0orkVEhAoIRDWpFf0NGsGinDXuLkBW5 AEoR4U80Xf9K4Or8Wre27lT2zjCWVUjURKhGqH28UKY92LM4+iWrLZoWGr2dCg6zSOlT /s5lPnuaBWa5ZX5OV++kUWNVYo6GvozF0AjHiOYt+F87ye/JYDpXDuV9Y0NC/Im8GlYi HKofGiPCNUPuWo/n+IBFsexppKXvnOpPCB+owDkyp5j8ogSbtK1J4YDI2xayZbayVbhe koksWVmfcLFhCIZ5C7SJs+WOiEyvIlS41iAkP4myaFfwh/uCYqSjLjBDMW6gH4Ddiyil MpMg== 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=u2y/COd7y8AES/tK0ar8bdl7+Wngd4RVNZyzRK4JZmE=; b=BocKrDyGSDsHR0lYWuqVEk7Z4YQOmxeic6W1xOLBVh09tpDYFI7Fx3/KfYJS93tBTS +pI7nTVh4fcToQZpOles1APf7id+dBJH7tQFsaMMSCCH/Ruz2UNnl4pL27tRqUI2setM M8QVuOrX99KVKSxW512wX5rkuADzzJGNV0WAe822WmyrNuNNAhL/NrKu2ThpS0BRjoYv i7xerCwRNL1uriv8Jrsk+ktuKZk2FiTo6j4v5n+TPGo5TlW8R0n7e4KHWUpbh10XupQr xX2jhXOf7Vf/kp2KuIRfp+Gruib1BVZFBQVWQNBpznc4EDHlXO6CGk6VZ4DNbqXPfcr5 gfoA== X-Gm-Message-State: APt69E2uYzKP3kczEeu5R4s6d11hriyWDXrdXA+1JKFZeqCjjeZSTkIF 4F5y63Uyf2tyInJ31TpgklI= X-Received: by 2002:a63:3201:: with SMTP id y1-v6mr1776666pgy.419.1528778194234; Mon, 11 Jun 2018 21:36:34 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id b22-v6sm15029438pfi.144.2018.06.11.21.36.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 21:36:33 -0700 (PDT) From: Zhouyang Jia Cc: Zhouyang Jia , Greg Kroah-Hartman , Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/tty: add error handling for pcmcia_loop_config Date: Tue, 12 Jun 2018 12:36:25 +0800 Message-Id: <1528778187-41182-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 pcmcia_loop_config fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling pcmcia_loop_config. Signed-off-by: Zhouyang Jia --- drivers/tty/serial/8250/serial_cs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c index 9963a76..c8186a0 100644 --- a/drivers/tty/serial/8250/serial_cs.c +++ b/drivers/tty/serial/8250/serial_cs.c @@ -638,8 +638,10 @@ static int serial_config(struct pcmcia_device *link) (link->has_func_id) && (link->socket->pcmcia_pfc == 0) && ((link->func_id == CISTPL_FUNCID_MULTI) || - (link->func_id == CISTPL_FUNCID_SERIAL))) - pcmcia_loop_config(link, serial_check_for_multi, info); + (link->func_id == CISTPL_FUNCID_SERIAL))) { + if (pcmcia_loop_config(link, serial_check_for_multi, info)) + goto failed; + } /* * Apply any multi-port quirk. -- 2.7.4