Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1215228pxx; Tue, 27 Oct 2020 10:55:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8Uy3rgnC4cTbECuCdq/OOSqg8CSuR4+I3E6liY2K7whHp5tvXI1vAq2ETYwD8hWH8u+x0 X-Received: by 2002:a05:6402:1653:: with SMTP id s19mr3676736edx.124.1603821300063; Tue, 27 Oct 2020 10:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603821300; cv=none; d=google.com; s=arc-20160816; b=vKm+Gj+kHGIeTMCRkgvq983QxbeWDHFL0OT9oqeqxPXIOZn9FPfLufIBSTqgUa4+LH ncgfjB4J1qyTaWuho8Xt92Mdcl2wvblKGIYJ0ggYu/zZ3FmHLIXbOeCK2lTBYGRhxjfy loJ/1FVihLfmxKdNhn2uUdeGMB+eMiTAlyj3eLY74lLyL2JzB/K8ZHTQvJSugyEgXQMI kauSMNqkLgZcauRIuuTsq6va4p2SOpgnTzvyIzYBLpyEkq4cmNUBzx4QeBrxkChqnsw2 hzmTdgCTgoB3mFg5xW/If9T6vdJpxbTpJy7eoC1Qb5HfQL9A4r60DhvGbKMDwNjaCg7U hGEw== 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=2F33+TnyAyZVZzBBZofEGYJeckpUQzxzsoS+A3Nb4B8=; b=KfpmIQ1XCmikc+oSqNAb2QGIk250VoXVnNS0dbRW+RqjOXyZ4MOOGgBAQIjarfSz0/ +jV6TBvvSQML3KcJ3VWCIOyKSKFaM/Rae00nSFwjx3Wyed9Sz2cdpqWnp0JaVW8hOkpL Sfx8TW1RM6yL/DpIQ6cfGFdJWSvNLYzHqK3GYxvFe1zINQVa0L89Jqid5rt/KdAiFiiw wjl5n2T2FvUvwatfJ3Fu02h8krtkjRxQiMP2bKbDwHxjTEp+32wfr6wKYfh3ZCPhX4Ed JwiksCoB6i42W/IRt0KJ+7WqXXmlBSBWlKe5zZvAHTHrfbch/3svaL+IGpyz38xnQ8DE 3R2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gvJDFpwG; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si1538815ejz.233.2020.10.27.10.54.38; Tue, 27 Oct 2020 10:55:00 -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=gvJDFpwG; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1818865AbgJ0RYV (ORCPT + 99 others); Tue, 27 Oct 2020 13:24:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:54596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2900796AbgJ0OyL (ORCPT ); Tue, 27 Oct 2020 10:54:11 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 949BA2231B; Tue, 27 Oct 2020 14:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810451; bh=biHJM8C+ItQFetRuYpsBSWjkyDAu9VvbvfyiUyE33Jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gvJDFpwGeaM7jVWiiuVZ+KlrR0y3HFiARUBn/uJQQWasYiJhufUAdpYhYq5dB/ghX HJZqAOqbZnem7n2bLPB4GTVZe9G5OHdYknSldtChvvn3tCTYxmcvPStwysqVSg7uoo LHGBjag7iImVaRedom6YBVxQlUCFknssNqsnhnz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.8 113/633] media: m5mols: Check function pointer in m5mols_sensor_power Date: Tue, 27 Oct 2020 14:47:36 +0100 Message-Id: <20201027135527.999038698@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Rix [ Upstream commit 52438c4463ac904d14bf3496765e67750766f3a6 ] clang static analysis reports this error m5mols_core.c:767:4: warning: Called function pointer is null (null dereference) [core.CallAndMessage] info->set_power(&client->dev, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In other places, the set_power ptr is checked. So add a check. Fixes: bc125106f8af ("[media] Add support for M-5MOLS 8 Mega Pixel camera ISP") Signed-off-by: Tom Rix Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/m5mols/m5mols_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c index de295114ca482..21666d705e372 100644 --- a/drivers/media/i2c/m5mols/m5mols_core.c +++ b/drivers/media/i2c/m5mols/m5mols_core.c @@ -764,7 +764,8 @@ static int m5mols_sensor_power(struct m5mols_info *info, bool enable) ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies); if (ret) { - info->set_power(&client->dev, 0); + if (info->set_power) + info->set_power(&client->dev, 0); return ret; } -- 2.25.1