Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp738458pxf; Wed, 24 Mar 2021 14:56:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlGEQcvc1RcdHpkk7QNIGwEr97N4WMBZoK88sglhCqeD7iUZ0H9RoBF8bNll2VGtbDJS9v X-Received: by 2002:a17:906:18a1:: with SMTP id c1mr5733514ejf.62.1616623006965; Wed, 24 Mar 2021 14:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616623006; cv=none; d=google.com; s=arc-20160816; b=qsU7gT7GnxY1vnk+VUPNRBxRWcPI1AZKJKV2qO9dAj529klU41yUPSB03reoGYinh9 MEBKXm2REY28/olOR63D0SV5crM2SSJtVApdQ35/aokv1fo+SDS0hhRGF96P7rmqR3rq ah5/+8ZkXIK9n9YoMuNMq+C6QqTF8geBmmlgUa6nTcxsqHh6ZzGeGImEBiBhT3seANdh CVDQ+YqJOPed5v66CffDOueUbk+/OUF+Le2MQv57tTeKVMPzNRhaqlex6iTE0btRvFU1 hz8Im2WBB9U4B3QU6EE82gRH4sPNWqh+f7VMNWB9sZvPWCnHbVAvODMJerJ1zQsprKYE FJNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=lzaRRaMft0jory4q1mDJxpzGwlb7Q2/FGx4f0ZTwcG8=; b=zNcbHdKe06q/skAbNR1mWZSADyNDK2K4yFarRNMMwp6wEonbSnnhmACGWtIoa0p7mI c013hofbl6YAIPkc9e4AuoKekpO0HTxNcp1cRX5FwVRfx2teQP8cyPh+Rn38GgoqgQYR lT6itAj9EHpGl5b0UlqNWVOnFdmZQYXX3dXZLLAu7djvdFRBzKsK7vJ2pWtdoQZPtNJT t6VG5QlHvIspueWMbusBodC3AmP2KouKOachhhikZKpzxPQAX3arOavys4HNeVIqowgB nD4JKzNYjXCn0FWPZQ+0ceYl/gSkztk8pEN5kdb5t4xwYRhKxeJiTuHJdhsvyGBlxCaT RN2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Rx2naT70; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qx6si2794090ejb.468.2021.03.24.14.56.23; Wed, 24 Mar 2021 14:56:46 -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=@gmail.com header.s=20161025 header.b=Rx2naT70; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbhCXCdp (ORCPT + 99 others); Tue, 23 Mar 2021 22:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232181AbhCXCdY (ORCPT ); Tue, 23 Mar 2021 22:33:24 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434D4C061763 for ; Tue, 23 Mar 2021 19:33:24 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id l76so1543734pga.6 for ; Tue, 23 Mar 2021 19:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=lzaRRaMft0jory4q1mDJxpzGwlb7Q2/FGx4f0ZTwcG8=; b=Rx2naT70/fIl7Wo+VXOdQIVUP8Xs6r0WTQO/hWpxA8kb+/TuskhKXqqWlkHz2QjoO2 UOSJohP800OXd7ovQo6EVUkrsflbjP2x/Sq0soaB4u4vGdAu3nC/9EbSkzJ+j3dkePgW u4bVkLSYDS844Xi6eTAXMQ3Jy2SzL9ZhfHsmNY2gPVZvN3gRB6U9gJhMyGw3NIfVTlSd kBB71dc5xp53aAL3p9hOT0I8Imfk3drnQ8xQH25h9quuziFn4GEK6E/92GCCTQyJdIsC r/Oy+Irn0Y3RpCPOuzOtAUTI7nl91xRxEPQcx6mTvW7lA/I/9TOUxW2iwPdSfSFSbyRH ilmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=lzaRRaMft0jory4q1mDJxpzGwlb7Q2/FGx4f0ZTwcG8=; b=WzdU5wNYxz+W51za+inwL3Jqx+YUEpsnlEa24L+Cp8iEo1vjgA1C2o64+58n7CEOPS u2MefR0vhZDMluiF2LMvIhrd1HeizRoW78VBVZuKqjE8vRvxoO0zscWU6m8UK+aEXIJ7 //VAjXVoiOMhlJ9GOu+GfbMtsAhrbn7D4BoqOsI3w1dMzNVLQnCkbAzgv5UapmGu1rob u9B10KsYn2QlT8SCgg0NPEYHEZl8fq71ZKSGVrKxE5VN8EySU2ncAGUEEh7B72OR0gM6 71WCYAjQA8kEA9ACkQ3eECUzW5o4H3GHKRq4NeIOYRmF8kTGfut8gcp3Vs5UIgoH4Na5 eZjA== X-Gm-Message-State: AOAM533Ee5g2JIOa3U55es6ONtqyEHMXuD961NCpXi4ztKRyf1Eaz1xT F1A/akvrwLZ6dIGoIaDKfaFOI8iij2RWeA== X-Received: by 2002:aa7:980a:0:b029:20c:5402:5de9 with SMTP id e10-20020aa7980a0000b029020c54025de9mr1049963pfl.18.1616553203482; Tue, 23 Mar 2021 19:33:23 -0700 (PDT) Received: from [10.146.0.22] ([45.135.186.62]) by smtp.gmail.com with ESMTPSA id w189sm466719pfw.86.2021.03.23.19.33.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Mar 2021 19:33:22 -0700 (PDT) Subject: Re: [PATCH] base: dd: fix error return code of driver_sysfs_add() To: Greg KH Cc: rafael@kernel.org, linux-kernel@vger.kernel.org References: <20210305102405.14940-1-baijiaju1990@gmail.com> From: Jia-Ju Bai Message-ID: <0de7b406-2df8-20cf-2863-11754dc087f6@gmail.com> Date: Wed, 24 Mar 2021 10:33:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/3/23 21:57, Greg KH wrote: > On Fri, Mar 05, 2021 at 02:24:05AM -0800, Jia-Ju Bai wrote: >> When device_create_file() fails and returns a non-zero value, >> no error return code of driver_sysfs_add() is assigned. >> To fix this bug, ret is assigned with the return value of >> device_create_file(), and then ret is checked. >> >> Reported-by: TOTE Robot >> Signed-off-by: Jia-Ju Bai >> --- >> drivers/base/dd.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/base/dd.c b/drivers/base/dd.c >> index 9179825ff646..f94bbef95258 100644 >> --- a/drivers/base/dd.c >> +++ b/drivers/base/dd.c >> @@ -413,8 +413,11 @@ static int driver_sysfs_add(struct device *dev) >> if (ret) >> goto rm_dev; >> >> - if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump || >> - !device_create_file(dev, &dev_attr_coredump)) >> + if (!IS_ENABLED(CONFIG_DEV_COREDUMP) || !dev->driver->coredump) >> + return 0; >> + > Trailing whitespace : Ah, sorry, I will send a V2 patch. Best wishes, Jia-Ju Bai