Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932927AbbGTPDP (ORCPT ); Mon, 20 Jul 2015 11:03:15 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:60145 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932605AbbGTPDO (ORCPT ); Mon, 20 Jul 2015 11:03:14 -0400 Date: Mon, 20 Jul 2015 16:02:54 +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: <20150720150254.GC11162@sirena.org.uk> References: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0/F9k67mP4yWSR/A" Content-Disposition: inline In-Reply-To: <1437396110-5192-1-git-send-email-henryc.chen@mediatek.com> X-Cookie: Stay together, drag each other down. 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: Add function check before called format_val 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 Content-Length: 1759 Lines: 45 --0/F9k67mP4yWSR/A Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 20, 2015 at 08:41:50PM +0800, Henry Chen wrote: > The regmap_format will not be initialize since regmap_bus is not assgined= =20 > on regmap_init(). It should has a function check before using=20 > format_val() to avoid null function called on regmap_bulk_read(). > - map->format.format_val(val + (i * val_bytes), ival, 0); > + if (map->format.format_val) > + map->format.format_val(val + (i * val_bytes), ival, 0); > + else > + memcpy(val + (i * val_bytes), &ival, val_bytes); Your changelog doesn't explan why we are in this code path in the first place without a format_val() and why a memcpy() is an appropriate replacement. It should, it's not clear to me that this is a good fix but I don't feel I fully understand the problem. --0/F9k67mP4yWSR/A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJVrQ2eAAoJECTWi3JdVIfQVjcH/RGqQYxD6WlraewRRDOxDDGe VV9NyVvDwHHYFhlBf82yu/3w/eWjWfVcyHFZ48Hulli6p38fZ2gsnb/g/hlOE/Ki Qy2yokw1AEcLh8ltFJFks6H0BxAXNFIQSUVipiOh2ybA8OqSA0cMlwmiA3mxsvIV dj/flmnXwN0ywEtaUaTx3t5M6/ilMXHkDzzzTG/8a3RQ72XERrF4I29T3FvznyV8 jX5RT5Cc2x+jU/GpLEWkDsPD/rQ6vcrST4LoOi1xvi8UowGU5EL1DLq/oBOXvhTZ JuMz/U7e+KjrHTycw5zO2OzMygfDWGEUTmbuoBQurxW9G41fKnUXPR5+bnj9Zus= =K91+ -----END PGP SIGNATURE----- --0/F9k67mP4yWSR/A-- -- 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/