linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: Intel: do cast earlier in sst_cdev_tstamp()
@ 2015-04-09  9:02 Dan Carpenter
  2015-04-09 10:00 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-04-09  9:02 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Vinod Koul,
	Subhransu S. Prusty, Jie Yang, Jarkko Nikula, alsa-devel,
	linux-kernel, kernel-janitors

My static checker complains about these because it looks like the
multiply can overflow and then we cast to a larger data type.  I don't
think this is a problem, but it's also harmless to do the cast earlier
so let's silence the static checker warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 718838b..7b50a9d 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -381,7 +381,7 @@ static int sst_cdev_tstamp(struct device *dev, unsigned int str_id,
 	tstamp->copied_total = fw_tstamp.ring_buffer_counter;
 	tstamp->pcm_frames = fw_tstamp.frames_decoded;
 	tstamp->pcm_io_frames = div_u64(fw_tstamp.hardware_counter,
-			(u64)((stream->num_ch) * SST_GET_BYTES_PER_SAMPLE(24)));
+			(u64)stream->num_ch * SST_GET_BYTES_PER_SAMPLE(24));
 	tstamp->sampling_rate = fw_tstamp.sampling_frequency;
 
 	dev_dbg(dev, "PCM  = %u\n", tstamp->pcm_io_frames);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ASoC: Intel: do cast earlier in sst_cdev_tstamp()
  2015-04-09  9:02 [patch] ASoC: Intel: do cast earlier in sst_cdev_tstamp() Dan Carpenter
@ 2015-04-09 10:00 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-04-09 10:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Vinod Koul,
	Subhransu S. Prusty, Jie Yang, Jarkko Nikula, alsa-devel,
	linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

On Thu, Apr 09, 2015 at 12:02:39PM +0300, Dan Carpenter wrote:

> My static checker complains about these because it looks like the
> multiply can overflow and then we cast to a larger data type.  I don't
> think this is a problem, but it's also harmless to do the cast earlier
> so let's silence the static checker warning.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-09 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09  9:02 [patch] ASoC: Intel: do cast earlier in sst_cdev_tstamp() Dan Carpenter
2015-04-09 10:00 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).