Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp158940pxx; Wed, 28 Oct 2020 01:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzu3vpzOKce/ZlHRFNPC+iJz71/o0iT02m3KI/fJtrgiEhC+3+cewW8PWOpCUYNi0awNauG X-Received: by 2002:a05:6402:1148:: with SMTP id g8mr6675300edw.271.1603872291426; Wed, 28 Oct 2020 01:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872291; cv=none; d=google.com; s=arc-20160816; b=hiKZIn24QWipWc0B6sC/WEUI7pmKe/lIB2XsrkqTnTbAZasb+KuaXj1xumOk+VpQrc 0QPvCCaqiW1aK0T+W0t9LB509AncqTplU5lJjzBVMrhCoNtGDYisxoFemuOQWCGdoyIO kD7eSRJTz45r/n37c8Smn132tOCHjPjRwuqbzimDRQa0P9DUpsc9B4kFfARAahADLNvr nkrz8qfdA2IOnYuOczCujYzYQlCHe1vThzvmWeI1vPzvDHwuu1ulkrloXzUMvRqmuWIP 7khgR+eIkpKgntg4GO/6mvSzDyyLgqaK6DFn0+f6pHy0BYS+zopLa0+43lOtLqIX4NuE v/gw== 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=PuuRWaKX6Vl3UV2spNitIf73aKm6QHDREyXYhOc3in4=; b=UtR/VIuLxpoamvaytH/N3ip0Wr1eiN4BxjBeZny62Z2tIaBBX4YNBEea5hPexfUpiP jWh1XljxQ1yxTp96CmbZd8+0hYplm7s9Gg/iGR1sUmRx5oe/rHbvoRLE5zXOVsgIqnv2 SjrDL9edKZAxKQG07ZhtwjVALPn3hNiayVomDnI1SLMfJZBo32Q3lT9pcUXrE2cURr/o JhMLr8BSAZwwoL1iaUi0kcq+gg+NtZfYJ9M6y53LKDd5ZcwWFp8rDTlyVRYaDOOycdtP jOVFjP0k7CWteJGrXKjdADxCn8lDNQknqt3OwdaQbDzIxI/tBFfGW/ENGPyDzT6EYxAN zzWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ht+vHUVU; 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 x26si2664388eds.99.2020.10.28.01.04.29; Wed, 28 Oct 2020 01:04:51 -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=Ht+vHUVU; 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 S1752561AbgJ0N51 (ORCPT + 99 others); Tue, 27 Oct 2020 09:57:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:44220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S368195AbgJ0N5Z (ORCPT ); Tue, 27 Oct 2020 09:57:25 -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 E13B0206D4; Tue, 27 Oct 2020 13:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807045; bh=pMKRrqfvOHy/fjp+nLtLt0VDbwaeqH+dpUPi9NlYpJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ht+vHUVUbWB3aiH3Eth6nMy4IMOB3DB8eIR8FVJXylmwHf+atLMZZdIRwXW+ZX2ji 9ciYJMajc++mSZH5X/q+NBv+fw33PNxlgMAdwcfvJmMJ3OxTHM0vuZT7J3b6V17U/n oPxMEiJpVh3qPLPErJBBjYGHKWuWMMV8CPcuBBNI= 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 4.4 022/112] media: m5mols: Check function pointer in m5mols_sensor_power Date: Tue, 27 Oct 2020 14:48:52 +0100 Message-Id: <20201027134901.615577686@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 6404c0d93e7af..514267680dc96 100644 --- a/drivers/media/i2c/m5mols/m5mols_core.c +++ b/drivers/media/i2c/m5mols/m5mols_core.c @@ -754,7 +754,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