From patchwork Wed Aug 17 12:49:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 12945818 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 65E28C25B08 for ; Wed, 17 Aug 2022 12:49:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 63DD01651; Wed, 17 Aug 2022 14:49:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 63DD01651 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1660740597; bh=kYOYATKAKktz41sDaZZq1GXiosh7ennmO+42v74MCX0=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=qYY4pzFv3S4D61AYLmADEr9dtnqWo9cBo7PZtgkv5e3OhSvZoPFeQkPnnzYN9rJm4 q5fgsWv2ucQKipoI9yi3MZPT39XQu0q2ccFkLlb0BI3n9+gYSp50g/GD+tzC4qvGV7 A8DNbr+f6zcpj/ST481uGbxRI5l/H1gZLF3Kekrw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 05DCBF80518; Wed, 17 Aug 2022 14:49:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A82A6F8051A; Wed, 17 Aug 2022 14:49:05 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B6F84F800DA for ; Wed, 17 Aug 2022 14:48:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B6F84F800DA Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P1mcuwMr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660740539; x=1692276539; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kYOYATKAKktz41sDaZZq1GXiosh7ennmO+42v74MCX0=; b=P1mcuwMrm5gk2njvsIckP7pIF1uzHRdtJGgTElu5bg4re3OaIypNm5Lb Dswb0mczOCgfEKV58kL048dQ78P/EqK/cJav5htMR38z8EbCZVtoLbOdT jivgv0FF1YLSqEdrXwZJWXWhMtIAWEbZgGaB6omNqGwcncq5/5sbTaJFA Wkv/DeCOS6l8AkPZ+O7JFL5Zj6XfWQKF/X5QMQpzv8vdsBYMQwGuQh4ME rFzf2A02uugx0D19jTE/TmXVVp8LKvhYiK8bBtn4ZB/v3RwYqC0cv0EM1 mh7jUOyki02LWy2I96LsvT1+98uL/F+22rk34oF1HfSdJlWLbZZ29bIJC A==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="293759199" X-IronPort-AV: E=Sophos;i="5.93,243,1654585200"; d="scan'208";a="293759199" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 05:48:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,243,1654585200"; d="scan'208";a="583755219" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by orsmga006.jf.intel.com with ESMTP; 17 Aug 2022 05:48:54 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Takashi Iwai , alsa-devel@alsa-project.org Subject: [RESEND][PATCH] ALSA: info: Fix llseek return value when using callback Date: Wed, 17 Aug 2022 14:49:24 +0200 Message-Id: <20220817124924.3974577-1-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: Cezary Rojewski , linux-kernel@vger.kernel.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" When using callback there was a flow of ret = -EINVAL if (callback) { offset = callback(); goto out; } ... offset = some other value in case of no callback; ret = offset; out: return ret; which causes the snd_info_entry_llseek() to return -EINVAL when there is callback handler. Fix this by setting "ret" directly to callback return value before jumping to "out". 73029e0ff18d ("ALSA: info - Implement common llseek for binary mode") Signed-off-by: Amadeusz Sławiński --- sound/core/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/core/info.c b/sound/core/info.c index b8058b341178..0b2f04dcb589 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -111,9 +111,9 @@ static loff_t snd_info_entry_llseek(struct file *file, loff_t offset, int orig) entry = data->entry; mutex_lock(&entry->access); if (entry->c.ops->llseek) { - offset = entry->c.ops->llseek(entry, - data->file_private_data, - file, offset, orig); + ret = entry->c.ops->llseek(entry, + data->file_private_data, + file, offset, orig); goto out; }