Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1143382pxv; Fri, 9 Jul 2021 19:22:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2oYVYOuF5AStDa4rRGsxxfb8Z4LV+Oy9iyjUkqrptFWQFbwiYG9eWL4ADNdOrzcvcEYXJ X-Received: by 2002:a17:907:d89:: with SMTP id go9mr25871862ejc.165.1625883771278; Fri, 09 Jul 2021 19:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883771; cv=none; d=google.com; s=arc-20160816; b=ZCpbNo15HI6BpmMDtFkv7FjII3LM0pC2Y6vtEHu//GmJ6DT8sUZVkzdiaL/mjAFapf heyhQllHit+RRtGe5sMZbNY54bbMP9ETEgTm/o/AInGBJH6HwlkGCVdGEwrH3oL9A2Vv 8DIf6Qr6Pl9sHjC9Nxt/dWvrKrMXfM5NJRR+AbWfVhwVuOVd0vh/MIRPK3IwXWfrbccD hqac2a/HLwk7zhV4NyXXald3WAW+FIrdJvRbdFAbWzDACLgCh9jtpeEkpUGJ6hhF8JGq mxMbl5UOYf8ui0GE2QWlpJwR6z9Dh6pcirqYuYbxvM2r8zQ4FsReEaa3BW7rhSInuOO7 bImw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pdTH6qTlS20MRtPiD7M2kIB2UpNkmqNGsS+dP5dZEN8=; b=QwriJNzQBzH0dya5AYrAsh/1PDln3AF4KW0rPlMAY/da9wV63Xf0fuzG0iIMFpKsO/ +rYuLQbSDKWusIVDuc71s/YhQtrX55Q9sR8Q14e9GvIrV4vY08MdUZlQeAbxl0GSOO2Y YEMSJwe3CQCuJiWmZc9izJaqTroZ7iCJCdt/isgch52TjPeGitQ7ym7wsFMRbVjf1zLO tv3JESW7aMti+PPHJQJ74A8B93gT148anTBgXiccwVYxJyPX+il9E3TkghrgrHJPYeks 74s30wLV2Nq530DiTch4hlxEn/wNMPBeC4HMLo6VqEdJ/+IqbAc+qVNpWf/h0zqgqrUW u95A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SNfgpv2N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si8629768ejc.745.2021.07.09.19.22.28; Fri, 09 Jul 2021 19:22:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SNfgpv2N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232508AbhGJCXS (ORCPT + 99 others); Fri, 9 Jul 2021 22:23:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232544AbhGJCWG (ORCPT ); Fri, 9 Jul 2021 22:22:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E930B61402; Sat, 10 Jul 2021 02:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883560; bh=CTqiA0nCJ1PAXq3EDSd5kAAfEFa48FGUGn2VsY6ulMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SNfgpv2NhGPIUaexNoRRK8tw7nGQDuU+PlT6tT8ESU3NW9F9uJmWsyJ9SksnYepek asbNwfqDTsT1KkIwf5ki1Xjh5L8bSqneP9Mq0HfymL0tSiR5IJTaTra8WF32kJ5Lue UjZLjK4tBX/5XcalUiuGRRVRtWLc2IP4tT5alkQWwgVgT8Ir6RqDbxY1Uq/NUuWMcM 7iliGbz+dVgjxq5nKXbOwaJytW3/tXS0cpiyrSKd6O2xrzVYQ7XvjrfaqGmliHTojC SK95/6KOO1wDd2ee1S7xkxHYaUsw6mRMFYmJBzBUXfcoNGymF/qbs261X0yLB51w46 kZHt/V9PcKJlw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jaroslav Kysela , Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.13 068/114] ALSA: control_led - fix initialization in the mode show callback Date: Fri, 9 Jul 2021 22:17:02 -0400 Message-Id: <20210710021748.3167666-68-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710021748.3167666-1-sashal@kernel.org> References: <20210710021748.3167666-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jaroslav Kysela [ Upstream commit e381a14c3e3a4e90e293d4eaa5a3ab8ae98b9973 ] The str variable should be always initialized before use even if the switch covers all cases. This is a minimalistic fix: Assign NULL, the sprintf() may print '(null)' if something is corrupted. Signed-off-by: Jaroslav Kysela Link: https://lore.kernel.org/r/20210614071710.1786866-1-perex@perex.cz Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/control_led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/core/control_led.c b/sound/core/control_led.c index a90e31dbde61..ff7fd5e29551 100644 --- a/sound/core/control_led.c +++ b/sound/core/control_led.c @@ -397,7 +397,7 @@ static ssize_t show_mode(struct device *dev, struct device_attribute *attr, char *buf) { struct snd_ctl_led *led = container_of(dev, struct snd_ctl_led, dev); - const char *str; + const char *str = NULL; switch (led->mode) { case MODE_FOLLOW_MUTE: str = "follow-mute"; break; -- 2.30.2