Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4414975pxa; Mon, 10 Aug 2020 08:33:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuIDXVEQaf7KGmgXziCnXBRt8JJASOWQYismZikpU2n525WDTwb35MmSldTmhnDA4WcC0h X-Received: by 2002:a17:906:6d91:: with SMTP id h17mr21240462ejt.531.1597073596467; Mon, 10 Aug 2020 08:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073596; cv=none; d=google.com; s=arc-20160816; b=S8H8br52tlCpnv4ggf7K3L+Oc86Yc6X2ZMoZTt2tUUZreg7YF60QNU8YgactU9FT2y qmNRbbD7/c/Z/dAGnlN1nGGJ5wacdkJ5kD/AxelMnydxAKnSGzBpSlutZen7sW5KRf6D RQEdYTVfIGK7iVTkU5dVH1uone/03Q/TolSqtqZDVNrUa2TTX0ysMaoSihRNnxzKVnkf AXoogh/sI3MIeQLcsD4e5JpX2hILyKnged+NywXfQATagwPBGR3uErREaV2tOW/t1w03 Gzym/k3LrME2KqvLy8d+z+Xg0nSYeUthUcAM7iwVbbwxKs/zU2zPtEtzCsPhfGc6AlyU n+9Q== 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=M94RKO+3lCode/97Wa8wLqbFo6/LpPM9q50JbiZxTvs=; b=BVYAL0Snm4q8QjITORHErvltvQsCkTegvHxfIrcZCfekmS/5PJJ4IxXEBE66wgd63V SVcUAVTCV6pskO54MGOb5t6L37TrwKftcG3UPkBDFgz9syAWdfCjQsApeVH3kB4cH6k7 +P/eBzstVh1y837UJfnHfcdoNss7Ch7KP+VR3RhAQjv8BIJbzMm2x43NHhB0jjMb8xrX ggBam0ZyKprtB1fjZqf8C9xVYvvU7HEFN0ZI0SmssGyvgRX2PHUCUBhriTkim0H2qUkk Vo7F2dK0CDk7eQtFKHA6NeeWwCt9ZUtC2MeVd4BYWUPpCoqPwMY2WXA3OTrvhffwFExo DwVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q2LXODy7; 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 i20si11312474edg.519.2020.08.10.08.32.52; Mon, 10 Aug 2020 08:33:16 -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=q2LXODy7; 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 S1728756AbgHJPbj (ORCPT + 99 others); Mon, 10 Aug 2020 11:31:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:38864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728723AbgHJPb3 (ORCPT ); Mon, 10 Aug 2020 11:31:29 -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 2316320774; Mon, 10 Aug 2020 15:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073488; bh=2PCh6oLuxOyKaB0b/W2A72/vMsTCi5EUt/McGv1HIXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q2LXODy7++fog29JxXbUe8nPJCnH5lMLxIiCzSSYfvpEG3/xBbWe+hb61IjBaygLe YDxyfin/jua6BB5FKggTm3h0/1U7ym8395OJy/Q4PBK9Mr7WsEakIEN6NhbKcJML9s 4UitCrb/9bvNcMigEmCE6lGnAQC2ArL9TTJ/8RVo= 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 4.19 22/48] i2c: slave: improve sanity check when registering Date: Mon, 10 Aug 2020 17:21:44 +0200 Message-Id: <20200810151805.310493685@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@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 47a9f70a24a97..88959c8580ce0 100644 --- a/drivers/i2c/i2c-core-slave.c +++ b/drivers/i2c/i2c-core-slave.c @@ -22,10 +22,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