Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp472089ybl; Fri, 9 Aug 2019 08:43:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNPhYIEiAjHQmztH0cAozr7ey5VB3XSGf3SpK0igMUBpPPL6ZP/bL7rk8T7v5obyTTgJTP X-Received: by 2002:a17:90a:ff17:: with SMTP id ce23mr10017282pjb.47.1565365428220; Fri, 09 Aug 2019 08:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565365428; cv=none; d=google.com; s=arc-20160816; b=zg4OaoBBuR54PVQGJor6o0qEviQG7miXpa7PxdgIOAPVT+ewRLUIvtQGjuaGXqGp9c BHobMwheJD1r6kwR8YeNUFi4wBfm921KzQDe1k0xeCMLeF60JoZY8mGxhSbsjMjb/4yP x253PqnKR3WZzwX5hhJRdVYoyGAsaVZNJhbcdDw0MxdCtk+VlkktqzR4u+zi51/GiIAK Yu33Gpv7vyKZ7DVWpaJM3Ve8TdeR39zuXwd2tKxMFf9xMkkvNBQKYUXGYbEf/G9XSAze vNcdDUAsAZtf4TRQkRG+t0BhTi+XHPizrQiNI8tZGS24o7mcAwokhpP6BVoN2skQFcSE z4qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2NAYwjzL1dHfuF0JlDfMzQKzMSvHPEidxjV09A0jqpk=; b=IXWVu4Q2UUqmH/7vxV54hRmGLhGCWniqbbWY6xvkakf7Pdvxpqm7HPOX3ncVE6lw7r i8UMQYq/oAWK6/9QcfuodUnqcuPfT/sPOA1lmIx26vwh/7tDS45Wlv8bqc3agnyDFqYv XTlLQPShFD2x3LRju1sQbv1KloTkJ192tIXn3N3cmt+fhRQy0hNVjCHKpZlB+bLo+SS4 PKYXxNRAgVtJqDhU3EzpwfPzVm7EIjiJtJocJp7AVqLpT/4ZgMeT74+DjEC0hKdgEEaf mXe4nUiKoHFpBG8WGgvyn7MjSgU1BNpO7xpPzVK5UxYmsynaAI5J82t1kR2/1NcNNEih LB6w== ARC-Authentication-Results: i=1; mx.google.com; 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 e14si8304948pfl.261.2019.08.09.08.43.32; Fri, 09 Aug 2019 08:43:48 -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; 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 S2436792AbfHIPlG (ORCPT + 99 others); Fri, 9 Aug 2019 11:41:06 -0400 Received: from sauhun.de ([88.99.104.3]:39226 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbfHIPlG (ORCPT ); Fri, 9 Aug 2019 11:41:06 -0400 Received: from localhost (p54B333D4.dip0.t-ipconnect.de [84.179.51.212]) by pokefinder.org (Postfix) with ESMTPSA id D59B82C3014; Fri, 9 Aug 2019 17:41:03 +0200 (CEST) Date: Fri, 9 Aug 2019 17:41:03 +0200 From: Wolfram Sang To: Laurent Pinchart Cc: Kieran Bingham , Wolfram Sang , linux-i2c@vger.kernel.org, Andrzej Hajda , David Airlie , Daniel Vetter , Mauro Carvalho Chehab , Hans Verkuil , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: Re: [PATCH] i2c: replace i2c_new_secondary_device with an ERR_PTR variant Message-ID: <20190809154103.GC5099@ninjato> References: <20190722172600.3452-1-wsa+renesas@sang-engineering.com> <9b71c556-bd70-4d29-dba5-fbeaefb5f3b4@ideasonboard.com> <20190808155709.GA1316@ninjato> <20190808160434.GT6055@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4ZLFUWh1odzi/v6L" Content-Disposition: inline In-Reply-To: <20190808160434.GT6055@pendragon.ideasonboard.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4ZLFUWh1odzi/v6L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Laurent, > > > > + if (IS_ERR(state->i2c_clients[i])) { > > > > + err =3D PTR_ERR(state->i2c_clients[i]); > > > > v4l2_err(sd, "failed to create i2c client %u\n", i); > > > > goto err_i2c; >=20 > This will call adv76xx_unregister_clients(), which will try to > i2c_unregister_device() all non-NULL i2c_clients entries. You need to Uh, right! Sorry for missing this :( > either set the entry to NULL here, or update > adv76xx_unregister_clients() to skip IS_ERR() entries. My preference > would be to store the return value of adv76xx_dummy_client() in a local > variable here, and set state->i2c_clients[i] after the error check. I implemented your preference and simplified adv76xx_unregister_clients() because i2c_unregister_device is NULL pointer aware. New patch coming in a minute. Thanks for the review, Wolfram --4ZLFUWh1odzi/v6L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAl1NlAsACgkQFA3kzBSg KbYrtw//eax3sE64XT5D8MkAUjtfesOD/GYUTnTU9ceRn7IEMMJBWCSuw24W6t5i tESvfnVngDidODNAHxiAxTLt1fIKkjEPcwE3WVviODWS0vx2nqCidralMM1VsX1y 4qZB6Ux1ESqmQe8DPFobbu2wCxXnPvqPz11BQyXb4DIlCVVyT5aQXSAtTc9+B8MU lZHU9yDBIkVneB6yIVp0H3nxxnXOsstFIQEHUbbIkMklgegyaqFWpzNLYSOtR1OZ RGBo9TrmK2abSXSIA3j2+TGhdO8EXrAtchoYa/PZMeR9npMCrdlraa7x8vXBMBji fTxZ2NuMbzPi5MWMvSxp6MILBK3MdO9Ph56VZs/RYAqDqkfvfvAbo8htSHglwxcY Qk2VxXKqUYs/vTOMwz4Zw45yR0ub1XGix+uxxmxq5P4rKRP7neHI5dq8cxMb5MfF YWBYdxzT3zbY2iMrx1QBRzgZZSPaR1aUuolkeo8qAyiyNz4yBG6A7gZqILGnx4Xq BEk69WTMCepDKrLiWB2m3G8m49e7StEaBF2D0F+RvV9jPu6CJ6p6tYGNT/Tqcop4 t8RDnxY5nSpxz3VdWTLsKLvPUcMSKltb4yoTnj82Rpx/mc3sl0k2tldYsdk0/4rK op46MBBe0WNEEkbOEgyycC/x3iT/YOX15X9wTdYqM5idUUEdQ/Q= =Tjl7 -----END PGP SIGNATURE----- --4ZLFUWh1odzi/v6L--