Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4760868rwb; Wed, 17 Aug 2022 05:50:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4pkJt3zSPl3DscSQwhVLxIKbRl4Xlu3iXBBDzzw+7jldZ0sxgvGKe2nbc9Ma4VjvE11Cb9 X-Received: by 2002:a17:907:9816:b0:730:73fc:1fae with SMTP id ji22-20020a170907981600b0073073fc1faemr16367387ejc.310.1660740606574; Wed, 17 Aug 2022 05:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660740606; cv=none; d=google.com; s=arc-20160816; b=v7yE5GQaaASw0SYiEpjpW5l6xLE6cNNADW0YV4Lx5MwKDX4Wu3gMq9Wr8d15mtR5iY s84ahIJCsPZoRoUSFZhAcyBmgk2VfAl+KN53yA3BMObS9F/DLg+lBq6aO0SCfyu8ofAA 9RonG4WvJlGfCZh2viyUkF9RypVVt+U0IyadXOgkFDkKcriQaT0T61rZcXRhrVmJsAz9 BJTcQGO96ei+fiyr8qQPMSrwiNBVREEMyi8da/MU6sE/Npcftc5sH9fcu8B0o9vuqYQq +dU+FYLyCAdmmSrPmNu53Gc1xUuWlaBGANtAuwSl1NeIAMCcq2NrVygNIiT03wl9S0Hm uOrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KPlhtfOJDO61CGKZBvuYjL7+oxPD1KmTuElRYDDXaMY=; b=jQrukM1AWfctKTeqeuL7T2bGCDTYPobhSS6/Gw5nnqpWCoVQF2lyumQpG7sRQVtm60 2AMBFlqfTMOqj2GBa2LJJ94pkiBJuxxl2pkXTrNWBp5ootx/FWBci8HrrnhcRQFXRtqS qsw5SJGridtjCO/k9ybYMtsvGbB0aW4WuMejWoUxcCigYk9I8MwZBiUXSQNf4GsdvRm9 CwLRLy7iMlfnW/9qju4AspggAJ9h8Qk7SXsZyQJB2eb028h1r8WLd2gfiE7Bn05W+sWR dPT97FCxoacPik18wFpSJceeST61GlONORLGvluO4keHcoM/uYSDJqC16T7IGZ0Ai1aB WDJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=BmFzNif2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a5099cc000000b0043bb6a22af3si11678678edb.387.2022.08.17.05.49.40; Wed, 17 Aug 2022 05:50:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=BmFzNif2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231527AbiHQMqM (ORCPT + 99 others); Wed, 17 Aug 2022 08:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236380AbiHQMqK (ORCPT ); Wed, 17 Aug 2022 08:46:10 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109758A6DB for ; Wed, 17 Aug 2022 05:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660740369; x=1692276369; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=kYOYATKAKktz41sDaZZq1GXiosh7ennmO+42v74MCX0=; b=BmFzNif2BqWreUkOOUtX5E9gtVH8H9Dsb+aki42myU77KoVdwOmeS+4o Q/cqpI//50i3NqOLqLwOQAuFPVXL8qaZWSDj95JbcBLWzF5tsQpCXR5AB nzcdRYfHnN3NwodGBTIytpI3IbWD2eHvs3zF5U0XsfoTNjhKoifqjyxEi wm1hBmSQR/t68UglNCnIZx0xbUdf6B2FXIlb7wN4ZHCctyf77ryC8LTCL Z770vZ1G8MRJk8YffLCxbvG8j3Ib0vx7UO+8KjyqCkFETe65lb6p8Ned9 oG86/VgxhNb9Ak9P95UJI4XSknTjZ+WjGwzlOttj8BeXEqOdeh5enKjo6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="293758726" X-IronPort-AV: E=Sophos;i="5.93,243,1654585200"; d="scan'208";a="293758726" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 05:46:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,243,1654585200"; d="scan'208";a="935344769" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga005.fm.intel.com with ESMTP; 17 Aug 2022 05:46:07 -0700 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= To: Takashi@vger.kernel.org, Iwai@vger.kernel.org, alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, Cezary Rojewski , =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Subject: [PATCH] ALSA: info: Fix llseek return value when using callback Date: Wed, 17 Aug 2022 14:46:42 +0200 Message-Id: <20220817124642.3974015-1-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.25.1