{"id":809070,"url":"http://patchwork.ozlabs.org/api/patches/809070/?format=json","web_url":"http://patchwork.ozlabs.org/project/openbsc/patch/20170902143403.14185-2-axilirator@gmail.com/","project":{"id":39,"url":"http://patchwork.ozlabs.org/api/projects/39/?format=json","name":"OpenBSC development","link_name":"openbsc","list_id":"openbsc.lists.osmocom.org","list_email":"openbsc@lists.osmocom.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170902143403.14185-2-axilirator@gmail.com>","list_archive_url":null,"date":"2017-09-02T14:34:03","name":"[2/2] pq_alsa.c: print error message if device init fails","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"505657d0876dfcdf82f74e6132a9b2fc92d1358f","submitter":{"id":67986,"url":"http://patchwork.ozlabs.org/api/people/67986/?format=json","name":"Vadim Yanitskiy","email":"axilirator@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/openbsc/patch/20170902143403.14185-2-axilirator@gmail.com/mbox/","series":[{"id":1156,"url":"http://patchwork.ozlabs.org/api/series/1156/?format=json","web_url":"http://patchwork.ozlabs.org/project/openbsc/list/?series=1156","date":"2017-09-02T14:34:02","name":"[1/2] pq_alsa.c: handle output buffer underrun","version":1,"mbox":"http://patchwork.ozlabs.org/series/1156/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809070/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809070/checks/","tags":{},"related":[],"headers":{"Return-Path":"<openbsc-bounces@lists.osmocom.org>","X-Original-To":["incoming@patchwork.ozlabs.org","openbsc@lists.osmocom.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","openbsc@lists.osmocom.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=lists.osmocom.org\n\t(client-ip=2a01:4f8:191:444b::2:7; helo=lists.osmocom.org;\n\tenvelope-from=openbsc-bounces@lists.osmocom.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"QGvY0nJw\"; dkim-atps=neutral","lists.osmocom.org; dmarc=pass header.from=gmail.com","lists.osmocom.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=QGvY0nJw","lists.osmocom.org; dmarc=pass header.from=gmail.com"],"Received":["from lists.osmocom.org (lists.osmocom.org\n\t[IPv6:2a01:4f8:191:444b::2:7])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkzDt4M0jz9sP1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  3 Sep 2017 00:35:58 +1000 (AEST)","from lists.osmocom.org (lists.osmocom.org [144.76.43.76])\n\tby lists.osmocom.org (Postfix) with ESMTP id 1955F38DD2;\n\tSat,  2 Sep 2017 14:35:57 +0000 (UTC)","from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com\n\t[IPv6:2a00:1450:4010:c07::22a])\n\tby lists.osmocom.org (Postfix) with ESMTP id 9276138DA9\n\tfor <openbsc@lists.osmocom.org>; Sat,  2 Sep 2017 14:34:11 +0000 (UTC)","by mail-lf0-x22a.google.com with SMTP id d17so8602553lfe.1\n\tfor <openbsc@lists.osmocom.org>; Sat, 02 Sep 2017 07:34:11 -0700 (PDT)","from DELL.lan ([92.127.181.248]) by smtp.gmail.com with ESMTPSA id\n\te11sm413177lji.82.2017.09.02.07.34.09\n\tfor <openbsc@lists.osmocom.org>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 02 Sep 2017 07:34:10 -0700 (PDT)"],"Received-SPF":"Pass (sender SPF authorized) identity=mailfrom;\n\tclient-ip=2a00:1450:4010:c07::22a; helo=mail-lf0-x22a.google.com;\n\tenvelope-from=axilirator@gmail.com;\n\treceiver=openbsc@lists.osmocom.org ","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=NoWfGqSNYiOUoK58govtGMCPudXGnl+vpcBwPuWAag4=;\n\tb=QGvY0nJw3vBMWE8D+1jdFRDznXwk0uXp7aHsDI6zlUhCYRn8XUc5xWf0V7ZAFz9+7V\n\tilpzXMF+PHCiE02e/+dmQilvP7ua/iilrnW9euHvTMGGLILSZry8PjRwSgPmws670I+X\n\tEGNusMU+ms9EjLfSIiOC20LJKug+4KZyb488wHoveYVQQXXolVg0zgDkjHuObfmfOJsf\n\tFdxF8438jgWXXF/ah6vkZPDiwJwfX7GNlnvvZ7KnrFmC7BWj5oarphSMMROjDlK257Pf\n\tdRHxB4dzS5HRXsfK6h/E6ZDzHN+uKp7UiOySNqF0JKUnTDM0TVV/A3Nye3qWBkEbGLq0\n\t0daQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=NoWfGqSNYiOUoK58govtGMCPudXGnl+vpcBwPuWAag4=;\n\tb=foXBWMkneVvTlO7tnXw/3bX53OFLjIJQIYrwuWIXqWMK8kq1ivod7XCH/k8dswcEEp\n\t+s6Hqi2vZZsE352TdNdFeIUg4GjwLNh4q4Xpq0a3pnU6PRyZ9E24R4uCmeiECHDW/SiM\n\tHDdovlQLbHpVp7Nm8tWytz4ge6D2k40Z4ggchTDdvqEVE4NbwTOZofa7moMjdtXGegoN\n\tsfa4lvLsgLFpKYbBDnhZGW+OKHvgrzTXZzjivnNxa0VmYTP3X5MQww/97GubglaXluon\n\tfBgLsqQH8JxcUo1Yk4B4zoGWgJiSrOrFcpoooPbHe71RA+t3PwtfnEXG9unC+bVDSePz\n\tMtCg==","X-Gm-Message-State":"AHPjjUi2KYT8d7mlxVdIAll+nOTbbVRFCdt0p+UzNBvQL8+xg5geCKTl\n\tb8uLihjUjjGIbANrzkM=","X-Google-Smtp-Source":"ADKCNb7BxghL6I3Bt8CfHFCVXVMuqvaciLMXTMldjKRpJZvDr+kzC47vE5GKKLYXdEQgSFLKI49kog==","X-Received":"by 10.25.33.65 with SMTP id h62mr2417128lfh.90.1504362850887;\n\tSat, 02 Sep 2017 07:34:10 -0700 (PDT)","From":"Vadim Yanitskiy <axilirator@gmail.com>","To":"openbsc@lists.osmocom.org","Subject":"[PATCH 2/2] pq_alsa.c: print error message if device init fails","Date":"Sat,  2 Sep 2017 21:34:03 +0700","Message-Id":"<20170902143403.14185-2-axilirator@gmail.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170902143403.14185-1-axilirator@gmail.com>","References":"<20170902143403.14185-1-axilirator@gmail.com>","X-BeenThere":"openbsc@lists.osmocom.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"\"Development of OpenBSC, OsmoBSC, OsmoNITB,\n\tOsmoCSCN\" <openbsc.lists.osmocom.org>","List-Unsubscribe":"<https://lists.osmocom.org/mailman/options/openbsc>,\n\t<mailto:openbsc-request@lists.osmocom.org?subject=unsubscribe>","List-Archive":"<http://lists.osmocom.org/pipermail/openbsc/>","List-Post":"<mailto:openbsc@lists.osmocom.org>","List-Help":"<mailto:openbsc-request@lists.osmocom.org?subject=help>","List-Subscribe":"<https://lists.osmocom.org/mailman/listinfo/openbsc>,\n\t<mailto:openbsc-request@lists.osmocom.org?subject=subscribe>","Errors-To":"openbsc-bounces@lists.osmocom.org","Sender":"\"OpenBSC\" <openbsc-bounces@lists.osmocom.org>"},"content":"---\n src/pq_alsa.c | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)","diff":"diff --git a/src/pq_alsa.c b/src/pq_alsa.c\nindex a3435dd..cad76ca 100644\n--- a/src/pq_alsa.c\n+++ b/src/pq_alsa.c\n@@ -85,13 +85,16 @@ pq_queue_alsa_op(struct pq *pq, const char *alsa_dev, unsigned int blk_len, int\n \tint rc = -1;\n \n \tstate = calloc(1, sizeof(struct pq_state_alsa));\n-\tif (!state)\n-\t\treturn -ENOMEM;\n+\tif (!state) {\n+\t\trc = -ENOMEM;\n+\t\tgoto out_print;\n+\t}\n \n \trc = snd_pcm_open(&state->pcm_handle, alsa_dev,\n \t\t\t  in_out_n ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 0);\n \tif (rc < 0)\n-\t\treturn rc;\n+\t\tgoto out_print;\n+\n \tstate->blk_len = blk_len;\n \n \trc = snd_pcm_hw_params_malloc(&hw_params);\n@@ -143,6 +146,9 @@ out_free_par:\n out_close:\n \tsnd_pcm_close(state->pcm_handle);\n \tfree(state);\n+out_print:\n+\tfprintf(stderr, \"[!] Couldn't init ALSA device '%s': %s\\n\",\n+\t\talsa_dev, snd_strerror(rc));\n \treturn rc;\n }\n \n","prefixes":["2/2"]}