Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2066475pxp; Mon, 7 Mar 2022 07:48:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSUblDs3WTTrA3ynsesumE2Yub5I3hUt1tIPvePxl5jVyXzRkXBnK5z6OSc6bY40fdUImp X-Received: by 2002:a65:554e:0:b0:34d:f721:7fef with SMTP id t14-20020a65554e000000b0034df7217fefmr10378146pgr.476.1646668123080; Mon, 07 Mar 2022 07:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646668123; cv=none; d=google.com; s=arc-20160816; b=se0jbywv81S84Y91sEVgrt652X2tb75i/3zkbngWJ9glwrTfT+k700Of9S35g9/+vL Y3HwsY7oTpBL4a8A8MnL34Kf/B+euExzCRPc8eK7KKHhJHKe4HxDNvTK59Q+cmOz19MQ sKorwAOYL498zk1fVQ3nP4zfrgo7T/IVlgKZa7Nd/349QBXSSMitx29uaWLunuZe49jo BHT0OYcal33asRVcgpXR4hE9v9YUreRlB56A22fAf9Vg07ep6i7WgscKf7am9+1KZgSP I/uw8S57QKRSVWB/Hyt6ECamzCDYsuNVqq7IXK4/oe04FFRG1Z9ncpua7VK9AMJBJQJX ZvmQ== 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=KsbNGkSPCWAjk1lbUOi7j8Pu1AZO5LlKIE8pImOWgxY=; b=lhUh9d1aV1m59XGH1dJ/zsDkbz3Xj/4W44tIGjzWO35JAbnHYFDxKAnS+xXcV0bAnw h9Pfemy9QqyAnQpYNnAxsVxiOO7jfWJW/cQfUfz/UlbPIs3Fj5hl7VXQTzDaSr9KcoR4 xFi7DbTJu83dXeIRWWFp0kvABiGQhKngDkLumbzuHg6v1Krcrh/3Si0LWzdy+HtBAyy9 4Nm5HA4mlvrOTm+HvpiOpZQSKobFIO4nMGSY1nEj3H1wanFBagUrVySj8ULKm8nROoQX YE2PMqWtGO8rr3v20JYbIsHoUkbPLZfK4Co22lAzL2KB565jFDgSDeFw53ZYBX1ObtjS JNFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EW+xC8wu; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a170902bb8400b001516c8962a0si11779124pls.277.2022.03.07.07.48.26; Mon, 07 Mar 2022 07:48:42 -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=@intel.com header.s=Intel header.b=EW+xC8wu; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243465AbiCGOyQ (ORCPT + 99 others); Mon, 7 Mar 2022 09:54:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243551AbiCGOxs (ORCPT ); Mon, 7 Mar 2022 09:53:48 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92DED35DED; Mon, 7 Mar 2022 06:52:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646664773; x=1678200773; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=d/3k4mHvlZwTsHccmScqQ+aEtnwgFzJWdq9diAD46iw=; b=EW+xC8wu/RN1SOmZiDloMXefskH/qZxfu2Fk1duvFJQIA2UOupxz29aW faXtvtArfoWkdspdYTIbRU58P/mlJQunIdPsm4/gqKoNhth8vM8jJp0WG MjdBSEQ/K/KQ6jwT2skTgk7cPPiQNN+Gs+ywuHCDV07bHWzCuwW8o47Mq U6GmI0fiSk/M4SAG9s0WXgo61/J1lXtATwZKBYDkZ48HJrnVN/aYgTJW5 vHZrPjl+240/A45NGd5h2iJiFW60iTXNbm83zpZ5acloPbvaLAx2z/K+4 RkEM17MhfKaWIcUYF82+Mrhf7QvoAKsTk7gRNDVDdhTHHiG2NjKi3Bg28 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10278"; a="254136272" X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="254136272" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2022 06:52:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,162,1643702400"; d="scan'208";a="687559044" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 07 Mar 2022 06:52:46 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 07 Mar 2022 16:52:45 +0200 Date: Mon, 7 Mar 2022 16:52:45 +0200 From: Heikki Krogerus To: Bjorn Andersson Cc: Andy Shevchenko , Rob Herring , Daniel Scally , Sakari Ailus , "Rafael J. Wysocki" , Hans de Goede , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Dmitry Baryshkov Subject: Re: [PATCH v4 3/7] usb: typec: mux: Check dev_set_name() return value Message-ID: References: <20220307034040.1111107-1-bjorn.andersson@linaro.org> <20220307034040.1111107-3-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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, Mar 07, 2022 at 06:33:47AM -0800, Bjorn Andersson wrote: > On Mon 07 Mar 02:08 PST 2022, Andy Shevchenko wrote: > > > On Sun, Mar 06, 2022 at 07:40:36PM -0800, Bjorn Andersson wrote: > > > It's possible that dev_set_name() returns -ENOMEM, catch and handle this. > > > > Thanks! > > Shouldn't we have a Fixes tag and be sent separately for this cycle? > > > > It seems appropriate to add: > > Fixes: 3370db35193b ("usb: typec: Registering real device entries for the muxes") > > > If the maintainer would prefer to get this into v5.18, it could either > be picked ahead of the rest of the series, or I can resubmit it on its > own. I don't think it's a critical fix though. Me neither. Acked-by: Heikki Krogerus > > > Reported-by: Andy Shevchenko > > > Signed-off-by: Bjorn Andersson > > > --- > > > > > > Changes since v3: > > > - New patch > > > > > > drivers/usb/typec/mux.c | 14 ++++++++++---- > > > 1 file changed, 10 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c > > > index c8340de0ed49..d2aaf294b649 100644 > > > --- a/drivers/usb/typec/mux.c > > > +++ b/drivers/usb/typec/mux.c > > > @@ -131,8 +131,11 @@ typec_switch_register(struct device *parent, > > > sw->dev.class = &typec_mux_class; > > > sw->dev.type = &typec_switch_dev_type; > > > sw->dev.driver_data = desc->drvdata; > > > - dev_set_name(&sw->dev, "%s-switch", > > > - desc->name ? desc->name : dev_name(parent)); > > > + ret = dev_set_name(&sw->dev, "%s-switch", desc->name ? desc->name : dev_name(parent)); > > > > We may use shorten form of the ternary > > > > ret = dev_set_name(&sw->dev, "%s-switch", desc->name ?: dev_name(parent)); > > > > at the same time, but it's up to you. > > > > I looked at it, but felt it was an unrelated change and decided to leave > it as is. > > > Either way code looks good to me, > > Reviewed-by: Andy Shevchenko > > > > Thanks, > Bjorn > > > > + if (ret) { > > > + put_device(&sw->dev); > > > + return ERR_PTR(ret); > > > + } > > > > > > ret = device_add(&sw->dev); > > > if (ret) { > > > @@ -338,8 +341,11 @@ typec_mux_register(struct device *parent, const struct typec_mux_desc *desc) > > > mux->dev.class = &typec_mux_class; > > > mux->dev.type = &typec_mux_dev_type; > > > mux->dev.driver_data = desc->drvdata; > > > - dev_set_name(&mux->dev, "%s-mux", > > > - desc->name ? desc->name : dev_name(parent)); > > > + ret = dev_set_name(&mux->dev, "%s-mux", desc->name ? desc->name : dev_name(parent)); > > > > Ditto. > > > > > + if (ret) { > > > + put_device(&mux->dev); > > > + return ERR_PTR(ret); > > > + } > > > > > > ret = device_add(&mux->dev); > > > if (ret) { > > > -- > > > 2.33.1 > > > > > > > -- > > With Best Regards, > > Andy Shevchenko > > > > -- heikki