Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1446597pxb; Wed, 10 Feb 2021 08:31:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNNMTW/Yely9KsMgnikV2HZFQ5n77XfJOJf7qYWEEDa7o8pdhIc8aKM3Dl2GmgN+NFK8X1 X-Received: by 2002:a05:6402:4253:: with SMTP id g19mr3871816edb.343.1612974674593; Wed, 10 Feb 2021 08:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612974674; cv=none; d=google.com; s=arc-20160816; b=YaCnfF3BuMYk/FJvJEqNMD/zFJh2nwC+oC2FoI45cIM7nIyM4VwX2NGBnst05Plgcr PtcP+eLbCxN5LJ3AVejE2TiF4UCHP/sJI8N4gJhA3HaI2hjM3sUBWjroZt1lt/YgzYYX 1NrAXoLAyZpcXpKdY3EOgBNMBEl3iPpb0oyKzmouuTKEHBs9YwJbC/3rNqiuNJzIez2v aLQLOklueFHXCxPSRouWk5S2e6zXtCDx02cmDu+aUh0mLPH6Y6Xw/y8J5ymDO3VU91GP lVYTWUaPr5jO1MAJCtgOP0raQQx3nwGCPVh+uVsBd+QzUFiiQYallRhm0K6EyVhE+FGd OBLg== 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=rkhGNQG431H7a4/O/oJ6RWaDYdESXQ6nPiGIWilyChA=; b=JBMN7y+HBe88B6edGSISf9vER+TYLQGOa7UXzq2vH/f+MEkYi1cbfks5hPN0Evrp7o toUNXCoKhAalkwQXRSaTzFdR7a9CBkJuBP08Ag1NOou0qGg8EbRgSKQ+tK6rB/HFkrUO 50jcSmr/2YYMRobRIQiu1cyGSAb9KY3yu8SIKX3Aj6kJpqayHf2EEIXkfkkH3rOF6EVM 4+I/XGhODNPQ26iOLWm90yCsHeqFwG3TgnzstcE11aUhxSQ99WtN+zNR6wcLhO3lmJKO sdCMSWgeOynkOsjijG7UFu/zhigrOQq3zVt694ublG7bib8Eqv9YqjPSc5LSbA0G1zT7 jJ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Uwrx4zEY; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id js10si1553131ejc.446.2021.02.10.08.30.50; Wed, 10 Feb 2021 08:31:14 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=Uwrx4zEY; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232014AbhBJQ2E (ORCPT + 99 others); Wed, 10 Feb 2021 11:28:04 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25447 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbhBJQ1z (ORCPT ); Wed, 10 Feb 2021 11:27:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612974388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rkhGNQG431H7a4/O/oJ6RWaDYdESXQ6nPiGIWilyChA=; b=Uwrx4zEYYtu9vUSqhdAWZzKNbjaKGxdHXlPgiZDvDWeyVfZM+UO+OuaHmzuAWrHdGGcQBv bTocK/H5gNQpQ15mgTFO8T1jHO7H0Hk6fBv9QVmIyhEm94FeNnlkasGWq360gR/HFo2wVI Qg2AdXslQ99dRa0k+34dkFTFTj3RzsE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-p0MuO-BePTO6J66lsbPGRA-1; Wed, 10 Feb 2021 11:26:24 -0500 X-MC-Unique: p0MuO-BePTO6J66lsbPGRA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 229B6801962; Wed, 10 Feb 2021 16:26:23 +0000 (UTC) Received: from treble.redhat.com (ovpn-120-169.rdu2.redhat.com [10.10.120.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD029190D0; Wed, 10 Feb 2021 16:26:21 +0000 (UTC) From: Josh Poimboeuf To: Dmitry Torokhov Cc: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , linux-kernel@vger.kernel.org, Peter Zijlstra , linux-input@vger.kernel.org, Randy Dunlap Subject: [PATCH RFC] input/elants_i2c: Detect enum overflow Date: Wed, 10 Feb 2021 10:25:28 -0600 Message-Id: <59e2e82d1e40df11ab38874c03556a31c6b2f484.1612974132.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If an enum value were to get added without updating this switch statement, the unreachable() annotation would trigger undefined behavior, causing execution to fall through the end of the function, into the next one. Make the error handling more robust for an unexpected enum value, by doing BUG() instead of unreachable(). Fixes the following objtool warning: drivers/input/touchscreen/elants_i2c.o: warning: objtool: elants_i2c_initialize() falls through to next function elants_i2c_resume() Reported-by: Randy Dunlap Acked-by: Randy Dunlap Signed-off-by: Josh Poimboeuf --- drivers/input/touchscreen/elants_i2c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index 6f57ec579f00..4c2b579f6c8b 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -656,8 +656,7 @@ static int elants_i2c_initialize(struct elants_data *ts) error = elants_i2c_query_ts_info_ektf(ts); break; default: - unreachable(); - break; + BUG(); } if (error) -- 2.29.2