From patchwork Thu Dec 24 00:04:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7914981 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 37C899F318 for ; Thu, 24 Dec 2015 00:04:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59F3220605 for ; Thu, 24 Dec 2015 00:04:29 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8D63520600 for ; Thu, 24 Dec 2015 00:04:27 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 481572664DB; Thu, 24 Dec 2015 01:04:25 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E976626586A; Thu, 24 Dec 2015 01:04:16 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id C49CC2658DF; Thu, 24 Dec 2015 01:04:15 +0100 (CET) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 63E0C265866 for ; Thu, 24 Dec 2015 01:04:08 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie3.idc.renesas.com with ESMTP; 24 Dec 2015 09:04:05 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id CCD23469D1; Thu, 24 Dec 2015 09:04:03 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id CE8168002E; Thu, 24 Dec 2015 09:04:03 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id C69018002D; Thu, 24 Dec 2015 09:04:03 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id KAB19358; Thu, 24 Dec 2015 09:04:03 +0900 X-IronPort-AV: E=Sophos;i="5.20,471,1444662000"; d="scan'";a="201146191" Received: from mail-sg2apc01lp0248.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.248]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 24 Dec 2015 09:04:02 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by HKXPR06MB1016.apcprd06.prod.outlook.com (10.161.181.156) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 24 Dec 2015 00:04:00 +0000 Message-ID: <87y4ckg1fp.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Andrzej Hajda In-Reply-To: <1450867041-729-4-git-send-email-a.hajda@samsung.com> References: <1450867041-729-1-git-send-email-a.hajda@samsung.com> <1450867041-729-4-git-send-email-a.hajda@samsung.com> User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 24 Dec 2015 00:04:00 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR06CA0033.apcprd06.prod.outlook.com (25.164.91.43) To HKXPR06MB1016.apcprd06.prod.outlook.com (25.161.181.156) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 2:IoTBROLSFcavNZtlTpFDkLJGlO1HXzzElxHY+ibPGBM4hIigj+Z8S8wf6s4Ntl8Qv4tKc5hLGF3OU31ZlB8QVtkaNgv0xEp0uKRGyM8jBB5kMBDZwvBOD8ROqY1zj5uxaBFN+3zU+BOngNrB+fUytg==; 3:tN+49mHjOrlpCKaJeX/jGi1N4ycqwyYLE9eKZ4dKqOJWKw8mUCD4iN8SudAeMKmU0Kb0fXRtBY2HrR6knffHPe7AD3gsYpHZGJguqlHK3bsySD8/ZfLpQg/AHDoDGLlN; 25:ya12eLBfZ+U1NiJFrtA95lBRUaApx6MydvOEvTpHwO9GUEpdLpv0VW2VzsSePyUODz9HbvMvrTHZKkVEQlD7fjey/hk/biw93neEVmR8trr6tlFdNy3BZMCrPiS/pEfyzcf0Cav7yDqAke0UCGiSt7wx3E3Eaq/oihscqEcZugizCPKJhIWeKXOFZRvwl334FiF2aICtrV8yuG2oIi63LeugqG0UatuifYen0/Qq/G6+UrE51XPFXUC28sLiVSDsBrAWTV4X0UgJIUn8B/Vhfg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB1016; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 20:dbBJokYmrDKfxRFOFkOpRP/2b4TIim/CZm0d4kkk93IiAVk3AT6lzMcKTxmG1X2gzBeTarvWPKX6DdKb/E9BudBsDG9UU/Z9t3lnJCF/Kw6lDuCZmSS4IfLnlXRYCbF8SeQy7hDZcANCtRbB+FgmhUjEdEqV2Kt1AH3UR6qmWep+ZQR/BY/pWR+E55KId49aBdJg+TiiIn6ettbnenvt5gOZhcDjkX3X2TXHXnE7YXPcwjMJWjf0lsdTh0BzJph/MExazP93VFh6q0j+A1eyimXT3s6MmfMuYbU+6Y0lT7ozpMVwSyfA7Z9onpZqiew+qlD+/X1NxOphe1WnsWd8AffjqRBFWlRANrCMAsn+zU8NNL5+5VxlgL+twWjJ87scLxyReeiTERCoQs7HvWUMTsJZ4smUSxCM36DefH9qlLSKFk3p/ZNKmr9Cc0+oZFgIP2IngEyqrq5+yqh1CD8BOZZe62iDM9iV0bp5ckwBlWWqeocOxT/NQj6BD+sGm3h+; 4:jYwPCa3bf2qoZQVCVQJz6QZG2RjaoSVv7KbQBtZ3aUy4SsGvl3T5wZy0i8gY0AF99CxE2FbmXAk7nFQpDVmV4TUVcRaWiVWPGjJde2Un2bX0+bz4O2iO/BgE8E6hmXrwZhksMB016j9ApkI7Orxb5uioTSzFQIgEFzNMMoniCmEGiYQKZ8p+GSa2gWFZ7MwmU+G/SIHzDy+OaPRKrUl0JhaD33yj2WOsuNHfyvnww5AhAmSNycTGB9yEQw0C763uKHso1PgB9d26ufH9Zme8TOf8F3CSPwOpH31k1hA48xlPPbyne8e8jRt326ZB+wUo006Jy6aHiXm6MckL5gYz0asWgsMhlb+GbQKJLa/yI5HghkiK9z+3EfrCkqycmPuK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:HKXPR06MB1016; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB1016; X-Forefront-PRVS: 0800C0C167 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(83506001)(86362001)(2950100001)(47776003)(87976001)(101416001)(66066001)(77096005)(54356999)(92566002)(15975445007)(42186005)(5004730100002)(5008740100001)(53416004)(50466002)(122386002)(40100003)(105586002)(69596002)(6116002)(19580395003)(19580405001)(76176999)(50986999)(33646002)(1096002)(3846002)(586003)(23726003)(81156007)(97736004)(106356001)(36756003)(189998001)(5001960100002)(46406003)(110136002)(4001350100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB1016; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRec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PP?= =?us-ascii?Q?u6iyZo3DyBcjrtWY7OmWKulzaHEZSouWgJuaoEx+PvuhOUMMGLEPUnRcPJmD?= =?us-ascii?Q?i9wQoiSj4tOenpmDDAQmqCuUnYHf2IFP7Kd76woX67Wl2uSXOnhshEt5klk1?= =?us-ascii?Q?+gYutD4/UrHqN3l9Zj3nHt2X660Z3pOHL2nXMlAEvrTsQVIpsHjttFHw5bb6?= =?us-ascii?Q?KeGqethyBx2l7SSdZosSd/uQ23FlSC6M/Jd5VEiIdkNQ6IDnOyhnVuUu+QrM?= =?us-ascii?Q?XoX/opBkbVFCI/r2JWQGQsmDq9jDgGsNdLCAhLQm2Ir9z719/KdAtjdblW4n?= =?us-ascii?Q?n+A5wPh6zM=3D?= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 5:wvGK2e9SlKNHBCCRLxE2SF3ttQfPc8d/KF6wDOPFhX27ks8Zrb/pY+Bl6yvca5kWWjHqpFtfHjUXIUM5WDKx4NkHOc6rRB6z87hZWGKwb6EH6CUa4ZJ+LKTRGj+8ZfTk82ma7hwdHz489ULBIms/fQ==; 24:YuA/IJqozELAnZvedUjS1ekBblcMX2s+wNiJoGfw9IS2JXu90i6WCXkTAj6kE1CkFlImdE+TELMoDNcf5o8axCjKyr32r3COhxZbQuoZl6U=; 20:SQvhmIy4O3X1a909K/7rYnyn9R2oXLnQny8nR9NC2f8xqZuW0k84HWiuUBbaBiQMwkmme+jv+O1YO+l09XYh4fcsBxHrbVJpNNbRBUz+0odWPQyRxrZzjIWBLBnoAT/DWwJOsjF16E6N2OBGHXIJOmfYOgqJDIZM7mj04WI/+IE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2015 00:04:00.2372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB1016 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Liam Girdwood , open list , Bartlomiej Zolnierkiewicz , Takashi Iwai , Mark Brown , Marek Szyprowski Subject: Re: [alsa-devel] [PATCH] ASoC: rsnd: fix usrcnt decrementing bug X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Andrzej > Field usrcnt is unsigned so it cannot be lesser than zero. > > The problem has been detected using proposed semantic patch > scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1]. > > [1]: http://permalink.gmane.org/gmane.linux.kernel/2038576 > > Signed-off-by: Andrzej Hajda > --- Thank you for your patch. good catch ! I noticed current error case is not good for ssi.c Can you agree below ? --------- --------- Best regards --- Kuninori Morimoto diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 7db05fd..e519e30 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -403,6 +403,12 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct device *dev = rsnd_priv_to_dev(priv); + if (!ssi->usrcnt) { + dev_err(dev, "%s[%d] usrcnt error\n", + rsnd_mod_name(mod), rsnd_mod_id(mod)); + return -EIO; + } + if (rsnd_ssi_is_parent(mod, io)) goto rsnd_ssi_quit_end; @@ -422,10 +428,6 @@ rsnd_ssi_quit_end: ssi->usrcnt--; - if (ssi->usrcnt < 0) - dev_err(dev, "%s[%d] usrcnt error\n", - rsnd_mod_name(mod), rsnd_mod_id(mod)); - return 0; }