Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3650209pxm; Tue, 1 Mar 2022 02:40:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmESIngjmu+UOCXehL/yJGXK1M6YWkU5lzfppbxK018RnXHUZscvGHnzNHc9ci6b/gepbq X-Received: by 2002:a17:906:7056:b0:6d6:dd99:f2a4 with SMTP id r22-20020a170906705600b006d6dd99f2a4mr3599963ejj.43.1646131208995; Tue, 01 Mar 2022 02:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646131208; cv=none; d=google.com; s=arc-20160816; b=TbzDHF+yRpvRLJJMeT0A3FfTJP7gw+LJs90x6hq9UEXeQIuQ/QkRj0ll4n0fKMuTKx tRKGXhrIUUaqsWnHB6QoZ7digY3yaOZv9uHOxMWxN9nYDlOKkY4S6l/90r64quGSZnQo noA8Jlnu3r/PU5COId3IRqrzhO9sNCM29/P30j4OiFbbPDLNwLKZ+68FszBX0UVd/Y98 l6zXV1/pRhpj9PBG0xhWYf8p2pq40yWcciqy1US2Ox9z4Pg7gHByovNqGU3tvNxXwQvn Xim0PVFjkSQgeurCGjmVY8t71/IeyZI6RxDeR0j2T7gnlCO7fDYniwxQoEm8yreQkZPU iW8w== 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=SH7BKZxPThE9TeccoqRlmHSDAbpqji1kQcAbZPM4yik=; b=Vb1REpBbqaGDgm7RaoE/X+Z5F/t+rTuvm42i7F7DxvLwjEfj6I+uV8XKbq48lMh5e9 BoheSMb6Tt7fG+QCSaMsiCQNpYwRVAXf6KKtTzn1h9tzt5IKf3fCjo3cpKhfF+zP8OFO AO4Hx/edZ3SJO2umI3L+QLWfmlMavVpzTo9hURr/8zmzuL6hsdMV1SC3wyKnHlkveCUM yS6QD/v0/uBlT4el19IUi6VVB2ibKHfdG8VHSOSEBSq3JFzeCCYrpxH1F5rOikO6R9Lp syuIEUO9Amw/Top+wQ8VB3SPqLy3GFxHkNTNHUbQyQIkXaPHANnkZSK5nensGKDcjgm0 sY5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ge1Da0sW; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k28-20020a508adc000000b004109a8d149asi8847538edk.536.2022.03.01.02.39.45; Tue, 01 Mar 2022 02:40:08 -0800 (PST) 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=@linaro.org header.s=google header.b=ge1Da0sW; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbiCAByh (ORCPT + 99 others); Mon, 28 Feb 2022 20:54:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbiCAByf (ORCPT ); Mon, 28 Feb 2022 20:54:35 -0500 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5247F0C for ; Mon, 28 Feb 2022 17:53:54 -0800 (PST) Received: by mail-oo1-xc2f.google.com with SMTP id d134-20020a4a528c000000b00319244f4b04so20939181oob.8 for ; Mon, 28 Feb 2022 17:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SH7BKZxPThE9TeccoqRlmHSDAbpqji1kQcAbZPM4yik=; b=ge1Da0sWeE+tqpMjsT64kOiWt8LAtWVXCsDWyFEpfMIYtGC3XmXur327uUyvKTqcJ9 pHSrCqJvbjI+J87pCRkOcUkWnZ6iv9y2s/dhTuqDW5KvoH0bFC5bTyW3KbzdBmyLWUg9 Toqim7tenpe3VhvO7sQRhxdXhduSoPWy2pCCR/xMAhUpGk08CsxgJkQhqq26fDMqbi4D 3t5Di6QRwd7b7R7ZcupOgGLqy/wfO49OAA9gp76WYJiQMls+cF9nlfDf6QbNcklF4QbM 4nUOsCOpcqBOp4CVSPFPc56vQPLjZ0GuPLuP6l2BHlNKtoGOE+VxSKO+r44Eduf+ET/W j1YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SH7BKZxPThE9TeccoqRlmHSDAbpqji1kQcAbZPM4yik=; b=tB7ug/Du3n3fEN3+639uzzgtzvu2SDpCA1kgE5qGFGdFMnM9qAxVUWhCS2hECaPqxl kPJHse33+TYiYmpUg+V8dWprc2XsycMkgVwUR+YBOkzXeWDgB/Vjjh7ADf/uTLoHIag4 DXWKVtBRD698dzVxOHjtFEjkMgtamwEl36uAEo9XHNMwPmuF9ViM9yR2NjnkmzNIQ8Y9 JIc96Ee7m27NAp5nsgRyVhBJ72S0wYXVHydCCszRRasnzlaYBOTsenQiUrQdAaLnQktc s/YowPmWApLApe04KiPB1jSwJZTwc2GQ149TtQ9HOIrPO2Z4TZvTK5n4eLFcpz25Q2hd RD1A== X-Gm-Message-State: AOAM531sWe8cvy/n3nkHMxn6jw3Mop5UPYAbYwa9c7tz4VeT4HQalP+g Y4+TLZNwLti5uzV9ywM5q4UJLdw9F4VJHQ== X-Received: by 2002:a05:6870:e997:b0:ce:c0c9:61d with SMTP id r23-20020a056870e99700b000cec0c9061dmr10096537oao.111.1646099634137; Mon, 28 Feb 2022 17:53:54 -0800 (PST) Received: from yoga ([2600:1700:a0:3dc8:5c39:baff:fe03:898d]) by smtp.gmail.com with ESMTPSA id 35-20020a9d0026000000b005ad363440a2sm5669549ota.64.2022.02.28.17.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 17:53:53 -0800 (PST) Date: Mon, 28 Feb 2022 19:53:51 -0600 From: Bjorn Andersson To: lotte bai Cc: agross@kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] soc: qcom: qmi: Use min() instead of doing it manually Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon 28 Feb 19:36 CST 2022, lotte bai wrote: > Fix following coccicheck warning: > drivers/soc/qcom/qmi_interface.c:773:12-13: WARNING opportunity for min() > Thanks for the patch Haowen. > Signed-off-by: Haowen Bai > --- > drivers/soc/qcom/qmi_interface.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/qmi_interface.c > b/drivers/soc/qcom/qmi_interface.c > index c8c4c73..3337a70 100644 > --- a/drivers/soc/qcom/qmi_interface.c > +++ b/drivers/soc/qcom/qmi_interface.c > @@ -770,7 +770,7 @@ static ssize_t qmi_send_message(struct qmi_handle *qmi, > > kfree(msg); > > - return ret < 0 ? ret : 0; > + return min(ret, 0); The code isn't trying to say "return the minimum of ret and 0", it says "if ret is negative return that, otherwise return 0". Mathematically this happens to be the same, but for me as reader of the code they have different meaning. Regards, Bjorn