Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2927539iog; Mon, 27 Jun 2022 05:58:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tBc7kAMynvYvXEBRJ1+ChuqxNHQd+KNhsgEXJGeE082Za4dTHsM9pkbM+9aG4y3J4PZArL X-Received: by 2002:a63:b444:0:b0:40c:f936:a21a with SMTP id n4-20020a63b444000000b0040cf936a21amr13158916pgu.37.1656334687321; Mon, 27 Jun 2022 05:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656334687; cv=none; d=google.com; s=arc-20160816; b=TcsRIB4zmeJSKUzhNs3OlD0juzK2ECLozVO2lJkPFyb29dkXQsFgVOA++64dU5K64r m5yQLZB0ziPQ5TafQj7HjhjgoV/6QlOci/nagW3e99/2ZeW/+DZHg/IBhshWu2WptfHC 0kustfB8tn0tXOPHizOXexW2iF3J5qxHpjyH1zsR4Qd3fNbN3Kd5/OzvoAzRMrWY8FBm tPGvp3DRN9c0YXY/j63AoyMcAyT05eSV0EY4xUkyPtSsDtlufMY5dB0VDV3ffFLRI1Pp wWh8C8Tba8cuEhRzrzuWf67y1De5P7r/eSdfrQWblDo/Nyd+XAHJ3+jxKxI9foJg6tu+ e/Sw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EVgPMQbaGLZjCDWM7PNRiNaJsiLIbj2gUVVbFA9TncQ=; b=NTuH3N7/4vrZI+IhrmihrQiyUSQrskmQ9tNZ7WRXuqF4IdkifcU1DXtby/+Ar7F1nB ANOI+8duVExNWUr3Fv3FOnrXgoUQXQnWy0S+vie5Wv+YUYkWvEJiJnaCzlNIzkthfWYE m8FU7VTkBO61HjWvdZKEN8Hsmovd9DpOki5rlAhSmyQphgwucCoPIIOBId3G1hoIjSSA x6SYXK1feo8suDcflz6X7zOaHMBXHJDhIJL69bWxonL4q8xZsj8GvswQKXX6lauStLxb 29y7rV9LmdAUtXZqXroM8niF5S4TuX3gKfrNlwEpGG4e0iT5WRX3UYjVEsFu5cQyUPC/ a6hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hHuydioK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a170902f79000b0015827ec0073si14970423pln.452.2022.06.27.05.57.54; Mon, 27 Jun 2022 05:58:07 -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=pass header.i=@linuxfoundation.org header.s=korg header.b=hHuydioK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239659AbiF0MAj (ORCPT + 99 others); Mon, 27 Jun 2022 08:00:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238917AbiF0Lwt (ORCPT ); Mon, 27 Jun 2022 07:52:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B30DF1D; Mon, 27 Jun 2022 04:46:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6F17461187; Mon, 27 Jun 2022 11:46:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6764EC3411D; Mon, 27 Jun 2022 11:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330384; bh=/OV4TQT7m05Fi0VZVfG2VTpYR5hu8IQh+pTF8a8E0mw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hHuydioKCse2QR7eMMQiz8HO1WK4Y1c/mqsIDHNjw/jwqEodPbCzTMG0Y+OKr9chZ NdnP2LztawpauRDoTdpPT8tVDWuSjqi9mugfW3JXabS431U/dmZbvN2tWVJtT3W2uN 2bN077MMGp0u4NTLhO28FvEWnl+0dPzWNkP0Q/5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean-Baptiste Maneyrol , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.18 140/181] iio: imu: inv_icm42600: Fix broken icm42600 (chip id 0 value) Date: Mon, 27 Jun 2022 13:21:53 +0200 Message-Id: <20220627111948.747069861@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Jean-Baptiste Maneyrol commit 106b391e1b859100a3f38f0ad874236e9be06bde upstream. The 0 value used for INV_CHIP_ICM42600 was not working since the match in i2c/spi was checking against NULL value. To keep this check, add a first INV_CHIP_INVALID 0 value as safe guard. Fixes: 31c24c1e93c3 ("iio: imu: inv_icm42600: add core of new inv_icm42600 driver") Signed-off-by: Jean-Baptiste Maneyrol Link: https://lore.kernel.org/r/20220609102301.4794-1-jmaneyrol@invensense.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/inv_icm42600/inv_icm42600.h | 1 + drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) --- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h @@ -17,6 +17,7 @@ #include "inv_icm42600_buffer.h" enum inv_icm42600_chip { + INV_CHIP_INVALID, INV_CHIP_ICM42600, INV_CHIP_ICM42602, INV_CHIP_ICM42605, --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -565,7 +565,7 @@ int inv_icm42600_core_probe(struct regma bool open_drain; int ret; - if (chip < 0 || chip >= INV_CHIP_NB) { + if (chip <= INV_CHIP_INVALID || chip >= INV_CHIP_NB) { dev_err(dev, "invalid chip = %d\n", chip); return -ENODEV; }