Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1459139rwb; Fri, 5 Aug 2022 02:14:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR5smm+RaOBly81BgNr5UfdiAUjmckVWIWhQerNB5nWpeoUk2kxvcqx6Ql17zVGiYBIKlVMY X-Received: by 2002:aa7:8896:0:b0:52e:7cba:ffd8 with SMTP id z22-20020aa78896000000b0052e7cbaffd8mr6125521pfe.82.1659690867783; Fri, 05 Aug 2022 02:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659690867; cv=none; d=google.com; s=arc-20160816; b=uqCdb/Vbtfi37/Rxa5urhBFquhJo+jJIi2TNKknALGVHlV2yeJL0rp8RLZJvi4WzP3 MeHa4zqM56oekcKEo9EQUpqJU/9ww35tDWfHaiylwBojeKk8L7mo3o0TWiyilDp0MiLG I8/V2T22VQbHDobWe+xkDA1puMACxSxoLN3hhnQhthA1NNbb2F+2DVakADQDHADtwBT/ +aK4gZjBXvRr3M9XR7bmGbIaF1fnJeS1YuCajFjGOMtkQo48f8q1+92QOVOVZ43z+BsE gX7J4l4PQOM4nkDtTzIvQVjHEE6aiCIjaxD0rfqWQ2nlAGHbqglkfwzgHe708D4lF8q8 XRnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:mime-version:message-id :date:subject:cc:to:from; bh=DALTtIoDZWwdnU148TyHZgrLTIWygyEGrj+ucmcDxTg=; b=y6WSSbnLoK1CQ1yw3flbE9pEBWLkETwX/TiYXSRp29hq45NwtgArCoGWjSeXHr1sjY GBPtUEPquI9F6G76xqC3U06Gxd4Rh2cy+hAN+S5zIEjdqZE8I0EzDRTAy7gWb22sGh9y oa8/ieHMK1DzYpmULVt7fgtc945F+7zeAn2PokNRthO3Uf2Su3Bc4QBwjPSk03Cc0CCe pzAVluke6ZXV5Qte9+ikOa+8lAbojK0UY20sFJPUyKMQLEDK4NJ+0bFSbSyQupX0yehO sGrRdC/OX/8SM8NIUwVYhJkdTFpjUrwlfKL56nFCHR3/muS3qFMms9i9Zdq3TQaUY7Vr 0LuQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a654c0f000000b0041c5f9dbfa6si2533399pgq.62.2022.08.05.02.14.13; Fri, 05 Aug 2022 02:14:27 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237564AbiHEJLJ (ORCPT + 99 others); Fri, 5 Aug 2022 05:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233549AbiHEJLI (ORCPT ); Fri, 5 Aug 2022 05:11:08 -0400 Received: from unicom146.biz-email.net (unicom146.biz-email.net [210.51.26.146]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1832F1EC5E for ; Fri, 5 Aug 2022 02:11:03 -0700 (PDT) Received: from ([60.208.111.195]) by unicom146.biz-email.net ((D)) with ASMTP (SSL) id AJQ00157; Fri, 05 Aug 2022 17:10:57 +0800 Received: from localhost.localdomain (10.200.104.97) by jtjnmail201605.home.langchao.com (10.100.2.5) with Microsoft SMTP Server id 15.1.2507.9; Fri, 5 Aug 2022 17:10:58 +0800 From: Bo Liu To: , , CC: , , Bo Liu Subject: [PATCH] ipack: Check dev_set_name() return value Date: Fri, 5 Aug 2022 05:10:57 -0400 Message-ID: <20220805091057.19951-1-liubo03@inspur.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.200.104.97] tUid: 2022805171057bbe340732a631b8a3cdd0dcdeea3b3fc X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 It's possible that dev_set_name() returns -ENOMEM, catch and handle this. Signed-off-by: Bo Liu --- drivers/ipack/ipack.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c index b1c3198355e7..74d449858a61 100644 --- a/drivers/ipack/ipack.c +++ b/drivers/ipack/ipack.c @@ -429,8 +429,11 @@ int ipack_device_init(struct ipack_device *dev) dev->dev.bus = &ipack_bus_type; dev->dev.release = ipack_device_release; dev->dev.parent = dev->bus->parent; - dev_set_name(&dev->dev, + ret = dev_set_name(&dev->dev, "ipack-dev.%u.%u", dev->bus->bus_nr, dev->slot); + if (ret) + return ret; + device_initialize(&dev->dev); if (dev->bus->ops->set_clockrate(dev, 8)) -- 2.27.0