Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4419650pxa; Mon, 10 Aug 2020 08:39:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/PkXv/1ZUY6F9JGVGXzQ2FCzKCRFi5cp0XfaiF/f6qEwy7AUnEhMBHxQ6nQ8UFOUVyAET X-Received: by 2002:a17:906:7e0b:: with SMTP id e11mr21227098ejr.540.1597073970991; Mon, 10 Aug 2020 08:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073970; cv=none; d=google.com; s=arc-20160816; b=Pp4ZuDqh6lKAHu0NWiOMz7yYyycjaWj46JkhYGXrlgQqY0XYnWMg16ybEerWuYtj52 hkE2njWdUdik4JXMU7d+4+Ug1ArARg+nCWc7Wjqvk9EI9DPdlyJwKMlcB6DpuwGj/2a7 JoyLpSoSj4kOEdLModBS3+ZViDwCwHKHQY3Es/soxA7eRcXstEmFYynCWDpV9t5nh7wS Ucc3f2u6KdtgE7kIru9bW0nM73I24++CjZCs/jmZJg7coqXUY3NEkSGvvYAUEtbqyVqp Q4lWxPEmLWwMgdnZwrC29K++0wFshejHcMljUvU7H1LmlzavkHybw1CX+2/y3D7hIdGh Tasg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3L7OEd3vBhye+luHnYm7MbnMGFpSoLCWNA97hOJlnik=; b=cfWXDiE5lXbvhh1AMbgD0mmXEUFqeL0so6Fu53outp0uNG/Lgz+m0AaEShjWViOnE3 mktYLUH2p4BKvq7iDc4kIy0q0qnJ1fJ+O0VtjvfJilEWdD9Jnp37Um3na6Ud83jeWOzJ iaOmhwYoFrfTuhF0o67h04M47NYhlrO/KSfy4QTG4aAVl4vf+NxsKeV2mvRDCvHQVFKY pXoW/XyVhVHSc5dMzPGUAbvc1Zsec/xM3Eez2CVQOyTKeewgBUAr9rxrroV4dDFHskjM KW+7kQfFjTfJVtXl/L4X0KP148Ua4Jvs7t36KVwHR1NqXbAMrc/hrshfyqLYgpAJMERW zxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NelwukzV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rp21si10678962ejb.0.2020.08.10.08.39.08; Mon, 10 Aug 2020 08:39:30 -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=default header.b=NelwukzV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729296AbgHJPg1 (ORCPT + 99 others); Mon, 10 Aug 2020 11:36:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:33252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728738AbgHJP1X (ORCPT ); Mon, 10 Aug 2020 11:27:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9814322B47; Mon, 10 Aug 2020 15:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073241; bh=9MYJ4viWV0IEtWiX47EV+1kFx/B6YnfEQUrVtqU1GEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NelwukzVD9Gr2drTEf7sfWRmwfN99DDuRHGbQMn5RYwDJJ2Nu9mqXUk6vkYxf08pc SPxeBhBq+2sgiSIXtiXRScU9TIWph9wqkQmzmDZn5ga0UcenaSTmh9s5jhksmST+Ik Udf3XrHK7poegBN/AJvb/ADFeJ7Vcc/COp1GO7nM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Alain Volmat , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 36/67] i2c: slave: improve sanity check when registering Date: Mon, 10 Aug 2020 17:21:23 +0200 Message-Id: <20200810151811.220025603@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151809.438685785@linuxfoundation.org> References: <20200810151809.438685785@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang [ Upstream commit 1b1be3bf27b62f5abcf85c6f3214bdb9c7526685 ] Add check for ERR_PTR and simplify code while here. Signed-off-by: Wolfram Sang Reviewed-by: Alain Volmat Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/i2c-core-slave.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/i2c/i2c-core-slave.c b/drivers/i2c/i2c-core-slave.c index 5427f047faf06..549751347e6c7 100644 --- a/drivers/i2c/i2c-core-slave.c +++ b/drivers/i2c/i2c-core-slave.c @@ -18,10 +18,8 @@ int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb) { int ret; - if (!client || !slave_cb) { - WARN(1, "insufficient data\n"); + if (WARN(IS_ERR_OR_NULL(client) || !slave_cb, "insufficient data\n")) return -EINVAL; - } if (!(client->flags & I2C_CLIENT_SLAVE)) dev_warn(&client->dev, "%s: client slave flag not set. You might see address collisions\n", -- 2.25.1