diff mbox

[1/4] davinci-mcasp: correct tdm_slots limit

Message ID e6aa9fd05c44088ab8446f1c60d2056f92929483.1303408522.git.bengardiner@nanometrics.ca (mailing list archive)
State Awaiting Upstream
Headers show

Commit Message

Ben Gardiner April 21, 2011, 6:19 p.m. UTC
The current check for the number of tdm-slots specified by platform data is
always true (x >= 2 || x <= 32); therefore the else branch that warns of an
incorrect number of slots can never be taken.

Check that the number of tdm slots specified by platform data is between 2
and 32, inclusive.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Reviewed-by: James Nuss <jamesnuss@nanometrics.ca>
---
 sound/soc/davinci/davinci-mcasp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown April 26, 2011, 10:46 a.m. UTC | #1
On Thu, Apr 21, 2011 at 02:19:01PM -0400, Ben Gardiner wrote:
> The current check for the number of tdm-slots specified by platform data is
> always true (x >= 2 || x <= 32); therefore the else branch that warns of an
> incorrect number of slots can never be taken.

Applied all of these.  Please always try to ensure that your commit logs
are consistent with the rest of the subsystem so they don't need to be
rewritten.
Ben Gardiner April 26, 2011, 1:20 p.m. UTC | #2
On Tue, Apr 26, 2011 at 6:46 AM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Thu, Apr 21, 2011 at 02:19:01PM -0400, Ben Gardiner wrote:
>> The current check for the number of tdm-slots specified by platform data is
>> always true (x >= 2 || x <= 32); therefore the else branch that warns of an
>> incorrect number of slots can never be taken.
>
> Applied all of these.  Please always try to ensure that your commit logs
> are consistent with the rest of the subsystem so they don't need to be
> rewritten.

Thanks, Mark, for taking the patches anyways (and Liam for the Ack's)
-- Sorry I forgot the 'ASoC' tag (I noticed this patch was committed
as 049cfaa ASoC: davinci-mcasp: correct tdm_slots limit).

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca
diff mbox

Patch

diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index fb55d2c..e595756 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -644,7 +644,7 @@  static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
 		mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
 		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
 
-		if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
+		if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
 			mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
 					FSXMOD(dev->tdm_slots), FSXMOD(0x1FF));
 		else
@@ -660,7 +660,7 @@  static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
 				AHCLKRE);
 		mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
 
-		if ((dev->tdm_slots >= 2) || (dev->tdm_slots <= 32))
+		if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
 			mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
 					FSRMOD(dev->tdm_slots), FSRMOD(0x1FF));
 		else