Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213814

Re: [PATCH] regmap: Fix the null function of format_val on regmap_bulk_read.

From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] regmap: Fix the null function of format_val on regmap_bulk_read.
Date 2015-08-26 14:40 +0200
Message-ID <q1I9J-5OH-45@gated-at.bofh.it> (permalink)
References <q1Hnj-4Eu-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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)
> [<ffffffc0004cbdd0>] mtk_rtc_read_time+0x9c/0x134
> [<ffffffc0004c9618>] __rtc_read_time.isra.3+0x40/0x7c
> [<ffffffc0004c9688>] 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.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] regmap: Fix the null function of format_val on regmap_bulk_read. Henry Chen <henryc.chen@mediatek.com> - 2015-08-26 13:50 +0200
  Re: [PATCH] regmap: Fix the null function of format_val on  regmap_bulk_read. Mark Brown <broonie@kernel.org> - 2015-08-26 14:40 +0200
    Re: [PATCH] regmap: Fix the null function of format_val on  regmap_bulk_read. Markus Pargmann <mpa@pengutronix.de> - 2015-08-26 15:30 +0200
      Re: [PATCH] regmap: Fix the null function of format_val on  regmap_bulk_read. Mark Brown <broonie@kernel.org> - 2015-08-26 19:40 +0200
        Re: [PATCH] regmap: Fix the null function of format_val on  regmap_bulk_read. Markus Pargmann <mpa@pengutronix.de> - 2015-08-27 07:50 +0200
          Re: [PATCH] regmap: Fix the null function of format_val on  regmap_bulk_read. Mark Brown <broonie@kernel.org> - 2015-08-27 12:10 +0200

csiph-web