Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp473648ybg; Fri, 18 Oct 2019 02:42:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzJj5gnEs/KEEi88reI5RKLPpTfiwDE4fZXooh4xdPV7UiYD70UvW6J3GlqtRtS6WGjHg8 X-Received: by 2002:a05:6402:b17:: with SMTP id bm23mr8490750edb.6.1571391738014; Fri, 18 Oct 2019 02:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571391738; cv=none; d=google.com; s=arc-20160816; b=IMX8X+Lk3F0el+F612zwQroyqLyBMEjdLxEQC4HYA7s1x14U1gXSpoyS6L0ByFbiHL daakcVdDnMyJG2DMcdMY/MyfgUwjdgtiKmJF+4STeOhJXoypMbOAsle6C6DAgXcWUzrU tVgpFPAluFS3td0orPiTThQMy6wXIDdm1aZ8WUkksrR412t0Od712HtNpigiADUHzSUX jqgEYRisoRxLMzAy1vFJ++L8UZ6XnrwB4DkiWAWkczl8bm2wLOf72yl8zUDFHOuLKGiA pi44a6Hpgno+lfkXQEvARYcW1YFeIDbQKbnoGJKWEVo1Zsm6TGjTGxf+cCDm/sSMDrOW Bgcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:user-agent:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature; bh=p/09wq1PSfYWS92X0S6/XOyJP24Y6whlcb1O9OKmBdU=; b=L9fgRCSeSCQAxyp4hcZ+YVgvYzby8Tiw7D3xlGzV/RdYmVx3XzajjGv3a/1sIeCXD1 MzbDRbzvNG4hd3/SZTPXAcATaoZyfio//W1DjLXumugi+olN9+UOCz9hlw7u4q6/PSS4 nDmdSwK/tQIVuyXmr4xrzeX1Pc4XItjFulBBUXUmYgEMqaV4pbs9IASXCAHrTRNZOXwD nNWa0GH414/GhX8KDFlrcLGgtr2xIIr4qpXgE9cTYyVYe/BR/jH3x+JzA0Ma/+9LDzvR GwBZ0772BTTxEmY8V2ngqGwxXEYAVOe8sDjf5Wi5mlbH+sw2/67W3jcFiG5JmlGnnReu YUEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=dXj8TVEY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si3498655eda.222.2019.10.18.02.41.54; Fri, 18 Oct 2019 02:42:17 -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=@st.com header.s=STMicroelectronics header.b=dXj8TVEY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394303AbfJQFnc (ORCPT + 99 others); Thu, 17 Oct 2019 01:43:32 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:12320 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731603AbfJQFnc (ORCPT ); Thu, 17 Oct 2019 01:43:32 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x9H5fC25008085; Thu, 17 Oct 2019 07:43:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=STMicroelectronics; bh=p/09wq1PSfYWS92X0S6/XOyJP24Y6whlcb1O9OKmBdU=; b=dXj8TVEYxlk2drKDKCEXJ+ewUYFx0mWN2Z/kG3vHixT7mjvvht8Lxa4qO4monsFFbG+E t37RQEWR242vxPbfsTvqhFlBGxuFwcHjnGCWO5dlwYe0X7erjdWXUpONUgU0OSMpQbK8 7RS8lTxxK8rXDtp/xpz6xUZReTsDLhUJ8PRjH/ZZt/uzceUgJeWTvsUtgv/p1dgDe32+ F/c5mOuR/EsLbSjygQwHiCUrhAk1QXbs8B/KKUP0zVAiTEey/m/lw7Yktrwa3HwK/FRV coISWEgSUUF6pMyDCRIJR9QXeRyEwHV/65sne7d4yZLeFllX3ITrk5Ie1YFrJIFSIK8X 4w== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2vk4a1ht4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Oct 2019 07:43:25 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id CCEF1100038; Thu, 17 Oct 2019 07:43:24 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag5node1.st.com [10.75.127.13]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id C26B02A44A0; Thu, 17 Oct 2019 07:43:24 +0200 (CEST) Received: from SFHDAG5NODE3.st.com (10.75.127.15) by SFHDAG5NODE1.st.com (10.75.127.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 17 Oct 2019 07:43:24 +0200 Received: from SFHDAG5NODE3.st.com ([fe80::7c09:5d6b:d2c7:5f47]) by SFHDAG5NODE3.st.com ([fe80::7c09:5d6b:d2c7:5f47%20]) with mapi id 15.00.1473.003; Thu, 17 Oct 2019 07:43:24 +0200 From: Mickael GUENE To: Chuhong Yuan CC: Mauro Carvalho Chehab , "linux-media@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] media: st-mipid02: add a check for devm_gpiod_get_optional Thread-Topic: [PATCH] media: st-mipid02: add a check for devm_gpiod_get_optional Thread-Index: AQHVhBBYvH4VqO4jG0ud7QMMFFTos6deMe0A Date: Thu, 17 Oct 2019 05:43:24 +0000 Message-ID: <8de93390-ae04-4278-bb34-aa175c659c23@st.com> References: <20191016105604.8036-1-hslester96@gmail.com> In-Reply-To: <20191016105604.8036-1-hslester96@gmail.com> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.49] Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-17_02:2019-10-17,2019-10-17 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Chuhong, Is this check necessary ? since looking into code it seems to me devm_gpiod_get_optional() can only return NULL in case of error due to following check in devm_gpiod_get_index= _optional() if (IS_ERR(desc)) { if (PTR_ERR(desc) =3D=3D -ENOENT) return NULL; } And in that case reset_gpio is not used Regards Mickael On 10/16/19 12:56, Chuhong Yuan wrote: > mipid02_probe misses a check for devm_gpiod_get_optional and may miss > the failure. > Add a check to fix the problem. >=20 > Signed-off-by: Chuhong Yuan > --- > drivers/media/i2c/st-mipid02.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid0= 2.c > index 81285b8d5cfb..d38e888b0a43 100644 > --- a/drivers/media/i2c/st-mipid02.c > +++ b/drivers/media/i2c/st-mipid02.c > @@ -971,6 +971,9 @@ static int mipid02_probe(struct i2c_client *client) > bridge->reset_gpio =3D devm_gpiod_get_optional(dev, "reset", > GPIOD_OUT_HIGH); > =20 > + if (IS_ERR(bridge->reset_gpio)) > + return PTR_ERR(bridge->reset_gpio); > + > ret =3D mipid02_get_regulators(bridge); > if (ret) { > dev_err(dev, "failed to get regulators %d", ret); > =