Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp925579imc; Mon, 11 Mar 2019 02:33:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqybnVlqFzjOqZ4hGssNIZknNfRzyOtZOH1lYLJnGke+Kt+4bZ/N03Papwz7jqoZ+MxtyWB1 X-Received: by 2002:a17:902:a40d:: with SMTP id p13mr32105674plq.144.1552296793578; Mon, 11 Mar 2019 02:33:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552296793; cv=none; d=google.com; s=arc-20160816; b=H/fPsAi6aeoZz3v4nlUfEuD7VnSXYJRslsR7TCjUeBEyqnz1AqCxQTT6miAJtIx07c 0NpStz90a5mFboOuw325EhymwSC2AIk30TjUlih+r9yIH/Wg/nXrneP94FbsMzrtUXLp suou53WBPiYoUC5/ZLGMCtUL0pslnjEtV2kOaBw0sFbV1O5ApmlA+/Fcfgbq4Tp+22AE 4u6TqdcO+xNOmlER3M65Apa5uRgTglu4pqgHMR5PNyGVF/mOH0ccOO6y1B3NAAaxr8R/ XcRYMzpVKODMHNdrmUnWnR6QmRHqJUfEhO/5x/8ahhwkSkY+sn5BvXhQMladzb109McD SmyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hqIA2qFNCheeLaC8TLgaUrIC9uHMFVYT0YrqgKTZVek=; b=y1zOxtpTWb1VKHihKCvtUfHbBLfwA2eIYJNELhkflg172t+T87wIv/b0mqQ4jjuRBp QO62TrgpLlu8h2m1eyYzILcDFLHtA6IOxqfKaI8yw0JOZLBBpEzw3lXx+TcbWgR03NmD 6Qd+OrVNw8bgT3gc7w9AIJRhYT4VZu/sNiTMyXxH80dcrr0kBgUCtUYrJrYTSrvmQXye DlsA80Me0wW5YKetguTDq5Zeqac9ejLHouzbNuVcJIBICK6h0rL+nc1m9OdBPlgQ5bz/ 2IyZ+1IgXFqIiukzQldUg/q2kDb1ye5m5yJpdQuq0PycsBKRm9NhWs+XQJBE4IrCGG6U kQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PUkfCqSU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p65si4745570pfa.27.2019.03.11.02.32.58; Mon, 11 Mar 2019 02:33: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=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=PUkfCqSU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727207AbfCKJb4 (ORCPT + 99 others); Mon, 11 Mar 2019 05:31:56 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:37116 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727109AbfCKJbz (ORCPT ); Mon, 11 Mar 2019 05:31:55 -0400 Received: by mail-oi1-f194.google.com with SMTP id w66so3067850oia.4 for ; Mon, 11 Mar 2019 02:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hqIA2qFNCheeLaC8TLgaUrIC9uHMFVYT0YrqgKTZVek=; b=PUkfCqSUQP12KMyFb9NfnfBgXE6E/Qpvf/JSjLJ80MpL1aT5Bepohve3GoQXsUslkC 11V3wMtE7prbopjGh6XifLrHouud67Pfo6DhzLskheS3qmEgrEJecAL0x6i4KOzwbhq3 QT3Gx42k32xJtZgr5zj4KeLltSp5s0gwXEd4DX8DexJx6tbQwOdkBtqjVmfW8XwsZ/FO 5gaoMZtKw8ZqubBNpCYpFSL1xlUgS9oj5JlCivqBChzqPwdq5H0be3vSZYctEE22Eygz mz6nN3x9JTXfBDCC0BvX6ePFnYuG9oGORSReP7InQho7lZeEPg9xIc1K7vWLt+P6RatL pKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hqIA2qFNCheeLaC8TLgaUrIC9uHMFVYT0YrqgKTZVek=; b=bT8uAYX0eC0ke77A54p0fIrzlnm+mcA7WwNWWFgKb6woGq8n9AqLLjbBjsd5fOm32i ch+apeDzZos3qcx0yV1p3Jq38mdJnvVnam05hhCHfxJn4LsTek3K2MI7z4aPdWEa1/5U UPqIsDBbeV169t4hBIqO9XZu1+nP5I+iZPjYYapTpsHSLXQIAKdqWJjiv6LlLuduPpuv vSVRwynfPbjID3rRT5ROHKKR4lrDbYyV2TuX2iFaJ1a7+5z3o0ujPIOxlrH/VULiat2z xTJnhc3aO8kqxeOG1OHisTfay1y5E6tNG0bYBzQCxc+UlRGU47Re30GEV5n3NBfGU63A cM6w== X-Gm-Message-State: APjAAAVhAm+tZixhjLMPMa73+ZtsXiEKVTNBZmPgyI2M45E5bwQC5k2v ogoUCLshjZ2dLZEZSukZoES53MJ1ItjLszIyQxfoxQ== X-Received: by 2002:aca:c1d7:: with SMTP id r206mr16243248oif.147.1552296714716; Mon, 11 Mar 2019 02:31:54 -0700 (PDT) MIME-Version: 1.0 References: <20190309040757.924-1-kjlu@umn.edu> In-Reply-To: <20190309040757.924-1-kjlu@umn.edu> From: Bartosz Golaszewski Date: Mon, 11 Mar 2019 10:31:43 +0100 Message-ID: Subject: Re: [PATCH] gpio: add a check for the return value of ida_simple_get fails To: Kangjie Lu Cc: pakki001@umn.edu, Linus Walleij , linux-gpio , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sob., 9 mar 2019 o 05:08 Kangjie Lu napisa=C5=82(a): > > ida_simple_get may fail and return a negative error number. > The fix checks its return value; if it fails, go to err_destroy. > > Signed-off-by: Kangjie Lu > --- > drivers/gpio/gpio-exar.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c > index 0ecd2369c2ca..a09d2f9ebacc 100644 > --- a/drivers/gpio/gpio-exar.c > +++ b/drivers/gpio/gpio-exar.c > @@ -148,6 +148,8 @@ static int gpio_exar_probe(struct platform_device *pd= ev) > mutex_init(&exar_gpio->lock); > > index =3D ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); > + if (index < 0) > + goto err_destroy; > > sprintf(exar_gpio->name, "exar_gpio%d", index); > exar_gpio->gpio_chip.label =3D exar_gpio->name; > -- > 2.17.1 > Applied, I Cc'ed stable and will send it to Linus Walleij once v5.1-rc1 is tagged. Bart