Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1808809rwe; Sat, 15 Apr 2023 06:26:46 -0700 (PDT) X-Google-Smtp-Source: AKy350blU2IGyVk+MNYupADp+tu+jPshcv5zeyaFPj932IXUFoMU8V8KhvW8+zxOMyTpz5L9bUj9 X-Received: by 2002:a05:6a00:b4f:b0:63b:5f78:d6db with SMTP id p15-20020a056a000b4f00b0063b5f78d6dbmr11397304pfo.21.1681565205929; Sat, 15 Apr 2023 06:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681565205; cv=none; d=google.com; s=arc-20160816; b=GzZnOs1SAjW7yk9JQENALirYEDHJ1mZhhWtBLEKJ6ksR91C66xXZCQuhzucS7SZm0s HKAlkT4sH120bZRi510AP85g9F1KqI8Jq6llKZLOE8BaPpOmkGthzGHonrOBMeA1KAyO 503j0zW3B2aXwxJdU6j3kn6T6Dk9I1KPs+t+oSRTfQkcHSy4ZrJpJ1xJnSp7ynt/W4eX TBf60VNoBR0W7dogLg+Lq4qXQFGlLVLBJH4c/Zob+alGVIe6FmhMvXqGyZ+n3iTCv9An mYfX02a1M3PPdVFiTD3js+JW5INVmK7wS8+oH4BBQeLnRZ09S639XkBX27GVf3hFwmBP J48A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MmkdB2m8LRfDVpq0AlbkUd9MRTLzgba0G5f/0MwvZKM=; b=m1LtwgM78H2B6HcBc/zCwC5S/yLdwJvMjKOAiX0T2UYXEKLkICjaW+Ic6pTOPUX2Aq AuoPlooYl/kFRZr+UB691RzBeB8Ut08pm5RBDDT5M4Fv7pZQZFyrc8eu+AIqjZwL0gAK wK53XNhiwo/Zqa2LUf8QeuxDZf8b46vnNXgwLcvHqWNiDivLZFjIvgMo7ZOuoc1UjKkt jMiPNoDkG9HozJ2gWT63QvGt8EcPyO4Fx5L69wv7unORbB8skfnR/CyRLa7QP/LmxSPk O0CPus9dYzx8HUhib9zrt3RiESGxU9eszbARLH4hrh2F3njuuEGI+nY33nzCvsLsbWLp S0wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=POTaPjGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 144-20020a621896000000b00633d39d7b09si6673529pfy.390.2023.04.15.06.26.31; Sat, 15 Apr 2023 06:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=POTaPjGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229899AbjDONJM (ORCPT + 99 others); Sat, 15 Apr 2023 09:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjDONJL (ORCPT ); Sat, 15 Apr 2023 09:09:11 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 672ED49F9; Sat, 15 Apr 2023 06:09:09 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id si1so22292048ejb.10; Sat, 15 Apr 2023 06:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681564148; x=1684156148; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MmkdB2m8LRfDVpq0AlbkUd9MRTLzgba0G5f/0MwvZKM=; b=POTaPjGb3OHOUpgy5zifdsNyPIwXCKUxu7EPej3sqe/Z7BvGs/j5qFd8y4lQE1Jeui IpgXJjIBYg6GkU2CfMmq6VH+QiSkhlLq6LSLMJsuc9ZylhrPbkYIpLk20a0NlNz/sQsH r+/Y6G5nPslMwdbW7TSWyBFNtTnz7AjH5DTWBfapEjmADr5Z4PCjMwlAbiI8pJH5oLcG 94YiHkE4EUFJBh3lY4JgHTDHdB8tRxDb7J2OufrZS6sv7Ag+duA7rdZgp6kkVNlYguQq cPcM6Ig3uV1+a8Xa99vwIz8SghLr8B/ueyi6bYxVnXIT5PQLcRuRdpMpo9edeReahm+a /H9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681564148; x=1684156148; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MmkdB2m8LRfDVpq0AlbkUd9MRTLzgba0G5f/0MwvZKM=; b=PP0NufdyECzYS7/qROGjEjIVPs7GyaXo51EzyRkUK8kvB+eC6NY5NOvEE17LmdUxHn rANF/q47wvPkS3ggG3otJ9fmmjYbL1yezv6ujKI7i/ThNKTXukTGXaqRGUNjnBZhxyZa NsVaXouma0HnBl4GLqehjLMTzuztXa5abLOxydN6ay/0/7YugUKaWWKKj6XdCAbHfA9l GuD0MrtgOAOOjqepp+F9rDYV4GeJ6zGK2LrXbHaNDcxsiYppoNF98vbsuHMY7KUT34fH ByFxpssOEPUt040F48tYZn22VSKfiVBwFRM/u39bhhje5XfkJO3tMvaAi6XJWL1nabG7 4fLQ== X-Gm-Message-State: AAQBX9cwahJ4CvxeAfSPVb31ikokZfzRzk8eR0RaPIdP3Nc27RQzeMQQ 8nVnlnPye3O3ztG0+gtODRmBGpntCBE= X-Received: by 2002:a17:906:d20d:b0:949:797e:ea91 with SMTP id w13-20020a170906d20d00b00949797eea91mr1877911ejz.56.1681564147760; Sat, 15 Apr 2023 06:09:07 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id fl3-20020a1709072a8300b0094f396c7a7asm74422ejc.214.2023.04.15.06.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Apr 2023 06:09:07 -0700 (PDT) Date: Sat, 15 Apr 2023 16:09:03 +0300 From: Dan Carpenter To: Christophe JAILLET Cc: Helge Deller , Cai Huoqing , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] video: fbdev: mmp: Fix deferred clk handling in mmphw_probe() Message-ID: <67353089-4966-424c-99c2-8524818f0e37@kili.mountain> References: <685f452cacc74f4983aaff2bc28a02a95e8aa8b7.1681414375.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <685f452cacc74f4983aaff2bc28a02a95e8aa8b7.1681414375.git.christophe.jaillet@wanadoo.fr> X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 13, 2023 at 09:33:17PM +0200, Christophe JAILLET wrote: > When dev_err_probe() is called, 'ret' holds the value of the previous > successful devm_request_irq() call. > 'ret' should be assigned with a meaningful value before being used in > dev_err_probe(). > > While at it, use and return "PTR_ERR(ctrl->clk)" instead of a hard-coded > "-ENOENT" so that -EPROBE_DEFER is handled and propagated correctly. > > Fixes: 81b63420564d ("video: fbdev: mmp: Make use of the helper function dev_err_probe()") > Signed-off-by: Christophe JAILLET > --- Presumably you already wrote a Coccinelle script for this but I've added it to Smatch as well. regards, dan carpenter diff --git a/check_zero_to_err_ptr.c b/check_zero_to_err_ptr.c index 88ca0285948a..fa2a1f1603b2 100644 --- a/check_zero_to_err_ptr.c +++ b/check_zero_to_err_ptr.c @@ -157,11 +157,12 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *data) { struct expression *arg_expr; struct sm_state *sm, *tmp; + int arg = PTR_INT(data); if (is_impossible_path()) return; - arg_expr = get_argument_from_call_expr(expr->args, 0); + arg_expr = get_argument_from_call_expr(expr->args, arg); sm = get_sm_state_expr(SMATCH_EXTRA, arg_expr); if (!sm) return; @@ -194,13 +195,36 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *data) } END_FOR_EACH_PTR(tmp); } +static void match_err_ptr_or_zero(const char *fn, struct expression *expr, void *data) +{ + struct expression *arg; + struct range_list *rl; + char *name; + + if (is_impossible_path()) + return; + + arg = get_argument_from_call_expr(expr->args, 0); + get_absolute_rl(arg, &rl); + + if (rl_intersection(rl, valid_ptr_rl)) + return; + + name = expr_to_str(arg); + sm_warning("'%s' is never a valid pointer", name); + free_string(name); +} + void check_zero_to_err_ptr(int id) { if (option_project != PROJ_KERNEL) return; my_id = id; - add_function_hook("ERR_PTR", &match_err_ptr, NULL); - add_function_hook("ERR_CAST", &match_err_ptr, NULL); - add_function_hook("PTR_ERR", &match_err_ptr, NULL); + add_function_hook("ERR_PTR", &match_err_ptr, INT_PTR(0)); + add_function_hook("ERR_CAST", &match_err_ptr, INT_PTR(0)); + add_function_hook("PTR_ERR", &match_err_ptr, INT_PTR(0)); + add_function_hook("dev_err_probe", &match_err_ptr, INT_PTR(1)); + + add_function_hook("ERR_PTR_OR_ZERO", &match_err_ptr_or_zero, NULL); }