From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933339AbbHZMgR (ORCPT ); Wed, 26 Aug 2015 08:36:17 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:35697 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755717AbbHZMgO (ORCPT ); Wed, 26 Aug 2015 08:36:14 -0400 Date: Wed, 26 Aug 2015 13:35:56 +0100 From: Mark Brown To: Henry Chen Cc: Matthias Brugger , Sascha Hauer , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, eddie.huang@mediatek.com Message-ID: <20150826123556.GB2977@sirena.org.uk> References: <1440589396-696-1-git-send-email-henryc.chen@mediatek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TakKZr9L6Hm6aLOc" Content-Disposition: inline In-Reply-To: <1440589396-696-1-git-send-email-henryc.chen@mediatek.com> X-Cookie: osteopornosis: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 94.175.94.161 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] regmap: Fix the null function of format_val on regmap_bulk_read. X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TakKZr9L6Hm6aLOc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Aug 26, 2015 at 07:43:16PM +0800, Henry Chen wrote: > The regmap_format will not be initialize if device driver not declare the regmap_bus > when registering the regmap. To avoid the null function of format_val when > called regmap_bulk_read(). It need to give a format function when regmap init. > Call trace: > [< (null)>] (null) > [] mtk_rtc_read_time+0x9c/0x134 > [] __rtc_read_time.isra.3+0x40/0x7c > [] rtc_read_time+0x34/0x58 Please don't paste entire backtraces in, they're enormous and tend to obscure the actual content while adding little value. If needed then edited highlights work better. I'm fairly sure I've mentioned this before... > @@ -783,8 +783,22 @@ struct regmap *regmap_init(struct device *dev, > map->defer_caching = true; > map->reg_write = _regmap_bus_raw_write; > } > +/* > + * For bulk read, need to hook the format function. > + */ > +simple_format_initialization: The indentation is all messed up here, we're misssing a blank line and the comment is not indented. > -skip_format_initialization: > + switch (config->val_bits) { > + case 8: > + map->format.format_val = regmap_format_8; > + break; > + case 16: > + map->format.format_val = regmap_format_16_native; > + break; > + case 32: > + map->format.format_val = regmap_format_32_native; > + break; > + } Why are these format functions sensible? Converting a null pointer dereference into data corruption wouldn't be ideal. The commit message should really cover this. --TakKZr9L6Hm6aLOc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJV3bKsAAoJECTWi3JdVIfQXMYH/A9IffVVQ6WD6+QPWoWQSbfC O26DLVbJx3+kMNKyoWg/6NzAsAkXZBZFqs2Uc4TkeVJkS3I4PKPT1jgVfYqC0KI0 1AFZ8kOHmHjVfLm1oM1SJ/bglGHC1MXNeX6+f56RDporml3RcGXNTSfuLtKuKH91 DugFiqkpe8EZbFbB3UgPzZEy/Ga1x8jFkKaWx0ogI1pVuUsTKSCHTnU+h6SUFuDd RWSMPbhjox2NysxxkEElXnxS+XkeT/iYdKcoFZtuDB7KRLO8YazRAd3fgjK78pu0 OgP9vGA+abbgIU/viTUSbRSKgXC02mFrg+OiQQw+2VeX6kKC3ErQet31/khmEC4= =Yo5v -----END PGP SIGNATURE----- --TakKZr9L6Hm6aLOc--