Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756473AbbBGQmN (ORCPT ); Sat, 7 Feb 2015 11:42:13 -0500 Received: from sauhun.de ([89.238.76.85]:45184 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755689AbbBGQmM (ORCPT ); Sat, 7 Feb 2015 11:42:12 -0500 Date: Sat, 7 Feb 2015 17:42:09 +0100 From: Wolfram Sang To: Russell King - ARM Linux Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: return proper ERR_PTR for clk_get when !HAVE_CLK Message-ID: <20150207164209.GA6263@katana> References: <1423163365-15267-1-git-send-email-wsa@the-dreams.de> <20150205234040.GV8656@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mP3DRpeJDSE+ciuQ" Content-Disposition: inline In-Reply-To: <20150205234040.GV8656@n2100.arm.linux.org.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2428 Lines: 63 --mP3DRpeJDSE+ciuQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 05, 2015 at 11:40:40PM +0000, Russell King - ARM Linux wrote: > On Thu, Feb 05, 2015 at 08:09:22PM +0100, Wolfram Sang wrote: > > clk_get functions return an ERR_PTR and not NULL in the error case. Make > > that consistent for the dummy functions when HAVE_CLK is not enabled. > > Otherwise unexpected codepaths might be trying to use a NULL pointer. >=20 > NAK. >=20 > There are some drivers which rely on this behaviour (take a driver, > such as some PXA IP) which uses the clk API but is also reused on > x86 which doesn't. Okay, thanks for the explanation. Let me recap, there are three cases that clk_get can return: a) pointer to a clk b) ERR_PTR meaning something went wrong when trying to get a clk c) NULL meaning there is no clk to get So, if this patch from i2c/for-next [1] wants to add optional clk support, it should fallback to the old handling not by checking for (!IS_ERR()) but for (!IS_ERR_OR_NULL()). Correct? [1] https://git.kernel.org/cgit/linux/kernel/git/wsa/linux.git/commit/?h=3D= i2c/for-next&id=3De961a094afe04c6c8ca1adac50c8d16513f31b93 --mP3DRpeJDSE+ciuQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJU1kBhAAoJEBQN5MwUoCm2GDcP/A9kOBqcJr1p6yE9GDJGngzf yUeuuvit4z9wVvBXFK1i4viQg9iEjT1OVyqDt8HttAQtQEVNIQEvdYGV5A0Eg8Qd ondNzXLD6Ma51Y+FuTuGPE/+XsPjD/DUqDpDPpQ8t5WPPoiNdB1UfQAlcRWEodOn 5raTmk28PjA+1Bg4sJ51fXYpN7lqAWPdpf96ZGkaT+a10xRAvu/zgrNGLmf+Ntpm wU8TLWdazA4AyR9BYX4AV7qolXRRspHhPctO3uwxnvOttF1hDpcTP8G0h/974DiS /rnWMT4Kbs1BF0NFLRZqC79mWwxVnfJS2ERUAmqq9QqcAo9XiX1ecMpihPZw37Au N9tdYfX92sc8ofqpQ6Nrk5MXUq/JSySZd0Oe2OeYcZcfdx3eGLg/SYb6Yjxy3FnR 07a8+icCU6JOiyLKm5c8BXs47awm0ITbjxFsmwWB7Prehy9D8ZOlK2k8JqSr+VM1 XZufV10wyQa671ysX5cwiUczn/Y3JiOncUEeTYc4ETUXNo3EVhIObD4gu4tXa0mS O2m3o+VQRsWJpKzs49rReYzgZwaLXPrPR9IpHfSVv3ftlmKtwz1p54uELLLEjA9T 3sLeVgHu633d7srKr5i9GLM5t7pF/NIYHa40auB+58ZcI+OEHLlseFhV8AldaoED hA0SvGQYspNYNW+tpI0G =f50l -----END PGP SIGNATURE----- --mP3DRpeJDSE+ciuQ-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/