Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp611360pxx; Wed, 28 Oct 2020 12:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx80b4VlyW7t+W2Qxyc7EblUNi4n25LPEGtXGDbUqlVWxd5xIWLfnITeCf7tSxgjNeAam9F X-Received: by 2002:a17:906:2987:: with SMTP id x7mr570986eje.301.1603912922251; Wed, 28 Oct 2020 12:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603912922; cv=none; d=google.com; s=arc-20160816; b=iDR5p3NiXx4qKunCf9AeOJ5vBjJd/aeUk9R59GsE9mQSA74BEStsHcorwi6ISJ5aCg RAWYxgNWYJm695N8V8spuym5nNqcWhw54YJbJTVZ/YbZjlZ+QhjvgGa3rD0MWWO2kqNd T56PJvs4SWf7Nbh6efyYb6QZoAn+YQVMAiT9U5PPIza+KMtT9CrZMXXQcNULnqCSqus8 KeneCPV1RlKLAbOsOfu7KoJhmmGKVjHNuT4ZW7ctiHO+mEKotBKw12T3ic38AexkxpJh emx+nWC3qzE3UFtIhA4T1QYOkyOJgn3h01vtAPqJ3CKeE7ANkPhqtTPGXXMChhJp4TSj FghQ== 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=DfWXZUGCmOG150/1QT6Cv5e5xQYr6w7YDZyAgaQVjro=; b=CkkIZ/awKXCVtppN3tRrGiPPrxs9h/7qjnQiemOr98qSUNvLeiycVUkdzQC/hu19/5 zHSw9AJtlU5MRuBdJIQXUqBhmL1O+arRL7+oK8Km4ZYtaIeqJ45K+4Sfm7T9symq6Vq2 pEwhq44t5m9FFGtJDY+657iX8CZKDRcEYF9YgwEkmhXCx+MdHqpuSX2tjZ7FWh5SNtHW m+WP+iTtYO0TnlKzGpw9jjHgRgB1j/EeEUs7NFZX7TQr4SJSyFzss7k6ehqgyzB1qrCU Fym3FC4sJXwyV1r4byBR4GkDI1PjubBN2/p86KoxC2z0O1wyypsz4gHRoEIWe9NI5yfM P1xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h3QS+Ysa; 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 co4si129868edb.461.2020.10.28.12.21.40; Wed, 28 Oct 2020 12:22:02 -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=h3QS+Ysa; 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 S1827284AbgJ0SWp (ORCPT + 99 others); Tue, 27 Oct 2020 14:22:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:50234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437164AbgJ0OCW (ORCPT ); Tue, 27 Oct 2020 10:02:22 -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 BD19F221F8; Tue, 27 Oct 2020 14:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807342; bh=21qaHhpW/Wwa7qW3sCqRpKHvcl5k0Y7T1+5VsKaCf/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h3QS+YsafKBHekUOFUfUsqCrkIORUUo4mVJf/3dXFpxwkJ+c5P5LEIpWeq/Se34/w AORuRCmfB/GySm9PvTrWlJIlBySDW5wEIv7vxSXcU/pvi0c++dKWlJqkz2Mk2KukAP WXL7M5chtYmsGipfqgCwPpYy2UkxJpstTPgPts4U= 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.9 018/139] media: m5mols: Check function pointer in m5mols_sensor_power Date: Tue, 27 Oct 2020 14:48:32 +0100 Message-Id: <20201027134903.003094307@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134902.130312227@linuxfoundation.org> References: <20201027134902.130312227@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 acb804bceccbc..e1736777e6ccb 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